Java OCA OCP Practice Question 1226

Question

Which of the following signatures are valid for the main() method entry point of an application? (Choose all that apply.)

  • A. public static void main()
  • B. public static void main(String arg[])
  • C. public void main(String [] arg)
  • D. public static void main(String[] args)
  • E. public static int main(String [] arg)


B, D.

Note

All the choices are valid method signatures.

However, in order to be the entry point of an application, a main() method must be public, static, and void; it must take a single argument of type String[].




PreviousNext

Related