-
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.
-
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.