The main method for a Java program is defined by

The main method for a Java program is defined by

a) public static main( )
b) public static main(String[ ] args);
c) public static main(String[ ] args)
d) private static main(String[ ] args)
e) the main method could be defined as in a, c or d but not b

Answer:  c.

Explanation:  In a, the parameter is missing.  The parameters are defined later in the text, but in effect, they allow the user to run the program and include some initial arguments if the program calls for it.  In b, the semicolon at the end of the statement is not allowed.  In d, “private” instead of “public” would make the program unexecutable by anyone and thus makes the definition meaningless.


Java

Learn More Multiple Choice Question :