Saturday, 19 September 2009

Java Certification Question 0098

Given the following main method in a class called Cycle and a command line of

java Cycle one two

what will be output?

public static void main(String bicycle[]){
System.out.println(bicycle[0]);
}

1) None of these options
2) cycle
3) one
4) two




Answer :

3) one

Command line parameters start from 0 and fromt he first parameter after the name of the compile (normally Java)

No comments: