|
Page 1 of 1
|
[ 1 post ] |
|
mkalaiyarasan
As a Family
Joined:
Tue Aug 25, 2009 5:25 pm
Beans: 35
In Bank: 0
College: studied
Degree: BE
Department: cse
State: Tamilnadu
Fav Quote: cse
Position: Employee
|
|
Fri Aug 28, 2009 4:19 pm
|
Post subject: Command line arguments
class PrintArgs {
public static void main (String args[]) { for (int i = 0; i < args.length; i++) { System.out.println(args[i]); } } } The name of the class is not included in the argument list. Command line arguments are passed in an array of Strings. The first array component is the zeroth. For example, consider this invocation: $ java printArgs Hello There args[0] is the string "Hello". args[1] is the string "There". args.length is 2. All command line arguments are passed as String values, never as numbers. Later you'll learn how to convert Strings to numbers.
|
|
|
|
|
Page 1 of 1
|
[ 1 post ] |
|