36: What if the main method is declared as private?
A: The program compiles properly but at runtime it will give "Main method not public." message.
37: What if the static modifier is removed from the signature of the main method?
A: Program compiles. But at runtime throws an error "NoSuchMethodError".
38: What if I write static public void instead of public static void?
A: Program compiles and runs properly.
39: What if I do not provide the String array as the argument to the method?
A: Program compiles but throws a runtime error "NoSuchMethodError".
40: What is the first argument of the String array in main method?
A: The String array is empty. It does not have any element. This is unlike C/C++ where the first element by default is the program name.
Friday, May 2, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment