Java OCA OCP Practice Question 2711

Question

Given that the working directory is bigApp, and the following directory structure:

bigApp     
    |-- classes  
    |       |-- com  
    |            |-- mypkg  
    |-- source  
            |-- com  
                 |-- mypkg  
                      |-- Main.java 

And the code:

1. public class Main { int doMore() { return 17; } } 

And the following command-line invocations:

  • I. javac -d source/com/mypkg/Main.java
  • II. javac -d classes source/com/mypkg/Main.java
  • III. javac -d classes/com/mypkg source/com/mypkg/Main.java

Which are true? (Choose all that apply.).

A.Invocation I will compile the file and place the .class file in the bigApp directory.
B.Invocation II will compile the file and place the .class file in the classes directory.
C.Invocation I will compile the file and place the .class file in the mypkg directory.
D.Invocation II will compile the file and place the .class file in the mypkg directory.
E.Invocation III will compile the file and place the .class file in the mypkg directory.


B and E

Note

B and E correctly describe the results that the -d option will produce.

Note that the Main class doesn't have a package statement.

A and C will not compile.

Option D is incorrect based on the above.




PreviousNext

Related