Java OCA OCP Practice Question 1610

Question

Which command from the JDK should be used to compile the following source code contained in a file named Main.java?

public class Main {
   public static void main(String[] args) { 
     System.out.println("Good luck!"); 
   }
}

Select the one correct answer.

  • (a) java Main
  • (b) javac Main
  • (c) java Main.java
  • (d) javac Main.java
  • (e) java Main main


(d)

Note

The compiler supplied with the JDK is named javac.

The names of the source files to be compiled are listed on the command line after the command javac.




PreviousNext

Related