Java OCA OCP Practice Question 1692

Question

Given the source file A.java:.

package top.mypkg;
public class A {}

And the following directory hierarchy:.

/proj
  |--- src
  |     |--- top
  |           |--- mypkg
  |                  |--- A.java
  |--- bin

Assuming that the current directory is /proj/src, which of the following statements are true?

Select the three correct answers.

(a) The following command will compile, and place the file A.class under /proj/bin:

    javac -d . top/mypkg/A.java//from ww w  .jav a2  s. co m

(b) The following command will compile, and place the file A.class under /proj/bin:

    javac -d /proj/bin top/mypkg/A.java

(c) The following command will compile, and place the file A.class under /proj/bin:

    javac -D /proj/bin ./top/mypkg/A.java

(d) The following command will compile, and place the file A.class under /proj/bin:

    javac -d ../bin top/mypkg/A.java

(e) After successful compilation, the absolute pathname of the file A.class will be:

    /proj/bin/A.class

(f) After successful compilation, the absolute pathname of the file A.class will be:

    /proj/bin/top/mypkg/A.class


(b), (d), and (f)

Note

In (a), the file A.class will be placed in the same directory as the file A.java.

There is no -D option for the javac command, as in (c).

The compiler maps the package structure to the file system, creating the necessary (mypkg)directories.




PreviousNext

Related