Using Command-Line Arguments
Helps us to pass information into a program when it is run
class CommandLine
{
public static void main (String args [ ] )
{
for (int i= 0; I < args.length ; i ++ )
System.out.println(“ args [ “ + i + “ ] ; “ + args [ i ]) ;
}
}
To execute a program, we write from the command prompt:
java CommandLine this is a test 100-1
0 comments:
Post a Comment