Java OCA OCP Practice Question 537

Question

Which of the following are legal entry point methods that can be run from the command line?

Choose all that apply

  • A. private static void main(String[] args)
  • B. public static final main(String[] args)
  • C. public void main(String[] args)
  • D. public static void test(String[] args)
  • E. public static void main(String[] args)
  • F. public static main(String[] args)
  • G. None of the above.


E.

Note

Option E is the canonical main() method signature.

You need to memorize it.

Option A is incorrect because the main() method must be public.

Options B and F are incorrect because the main() method must have a void return type.

Option C is incorrect because the main() method must be static.

Option D is incorrect because the main() method must be named main.




PreviousNext

Related