Java OCA OCP Practice Question 1385

Question

Which of the following method signatures are valid declarations of an entry point in a Java application?

Choose three.

  • A. public static void main(String... argv)
  • B. public static void main(String argv)
  • C. protected static void main(String[] args)
  • D. public static int void main(String[] arg)
  • E. public static final void main(String []a)
  • F. public static void main(String[] data)


A, E, F.

Note

An entry point in a Java application consists of a main() method with a single String[] or vararg String... argument, return type of void, and modifiers public and static.

The name of the variable in the input argument does not matter and the final modifier is optional.

Options A, E, and F match this description and are correct.

Option B is incorrect because the argument is a single String.

Option C is incorrect, since the access modifier is incorrectly marked protected.

Option D is incorrect because it has two return types, int and void.




PreviousNext

Related