Java OCA OCP Practice Question 57

Question

Given that the current directory is /user/home, with an application Java file in /user/home/Manager.java that uses the default package,

which are the correct commands to compile and run the application in Java?

A.   javac Manager /*from w w  w  . ja v  a  2 s.c om*/
     java Manager 

B.   javac Manager.java 
     java Manager 

C.   javac Manager 
     java Manager.class 

D.   javac Manager.java 
     java Manager.class 


B.

Note

The compilation command requires the full or relative name of the file, including the .java extension, making Options A and C incorrect.

The execution command requires the class name without a filename extension, making Option D incorrect.

Option B is the only correct set of compilation and execution commands.




PreviousNext

Related