Results 1 to 2 of 2

Thread: Quick Question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Sugar Grove, IL
    Posts
    99

    Quick Question

    It's been awhile since I have taken Java, and I can't remember how to set up an application's start up variables. i.e., if I have a program that says hello x number of times, depending on how it is started up. Like I type in java StartProgram x where x is = to 10 or whatever. Sorry if the question is kind of cryptic, it's early and the brain isn't quite working yet.
    In case of a water landing, my head may be used as a flotation device.

  2. #2
    No, the question makes sense, and here's then answer:

    Code:
    public static void main(String[] args)
    {
        if (args != null)
        {
            for (int i = 0; i < args.length; i++)
            {
                System.out.println(args[i]);
            }
        }
    }
    This example prints out every argument (if any) passed from java.exe to your class.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width