Java OCA OCP Practice Question 1291

Question

Which of the following are valid main() methods?

A.   public static void main() { }   
B.   public static void main(String[] argc) { }   
C.   void main(String[] args) { }   
D.   public static void main(String []args) { }   


B and D.

Note

The main() method of answer A is missing an argument.

The main() method of answer C is missing the public and static modifiers.




PreviousNext

Related