Can Java Keyword and Class name be passed from String args[] (Command Line arguments)?

Home / Uncategorized / Can Java Keyword and Class name be passed from String args[] (Command Line arguments)?

Question:
I studied in books that both cannot pass from command line arguments but when I tried in eclipse, both java keyword and class name are passing through command line arguments. Can someone tell me the reason behind it?
public class MakeSelection {

public static void main(String[] args) {

System.out.println("Number of arguments passed are " + args.length);
System.out.println("The First " + args[0]);
System.out.println("The second " + args[1]);
System.out.println("The Third " + args[2]);
System.out.println("The Fourth " + args[3]);
System.out.println("The Fifth " + args[4]);
System.out.println("The Sixth " + args[5]);
System.out.println("The Seventh " + args[6]);
}
}

And the arguments I set in Run configurations are:
java klnjcks ajkj bjknkj bjkbkj java MakeSelection

****And Output is:****
Number of arguments passed are 7

The First java

The second klnjcks

The Third ajkj

The Fourth bjknkj

The Fifth bjkbkj

The Sixth java

The Seventh MakeSelection


Answer:

Read more

Leave a Reply

Your email address will not be published. Required fields are marked *