Java OCA OCP Practice Question 1299

Question

In order for the MyProgram program to be compiled and run, which of the following must be true?

  • A. The MyProgram class must be defined in MyProgram.java.
  • B. MyProgram must be declared public.
  • C. MyProgram must have a correctly formed main() method.
  • D. MyProgram must import java.lang.


C.

Note

For a class to be compiled and run, it must have a correctly formed main() method.

It does not need to be declared public.




PreviousNext

Related