Java OCA OCP Practice Question 3074

Question

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

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

And the code:

package com.mypkg;  
public class Main {  
  int doShape() { return 42; }  
} 

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.    Under the bigApp/classes directory, invocation II will build com/mypkgsubdirectories, and place the  .class file in mypkg.
E.   Under the bigApp/classes directory, invocation III will build com/mypkgsubdirectories, and place the  .class file in mypkg.


D

Note

D correctly describes the results that the "-d" option will produce.

A and C will not compile.

E inaccurately describes the directories that will be built.

B is incorrect based on the above.




PreviousNext

Related