Given the default default path:
/ Foo
And this directory structure:
foo | test | xcom |--A.class |--B.java
And these two files:
package xcom; public class A { } package xcom; public class B extends A { }
What allows B.java compilation? (Select all that apply.)
a. Set the current directory to xcom , then call
javac B.java
B. Install the current directory on xcom , then call
javac -classpath . B.java
C. Set the current directory to check, then call
javac -classpath . xcom/B.java
D. Set the current directory to check, then call
javac -classpath xcom B.java
E. Set the current directory to check, then call
javac -classpath xcom:. B.java
To compile B.java compiler must first find B.java . Having found B.java , he should find A.class . Because A.class is in the xcom package, the compiler will not find A.class if it is called from the xcom directory. Remember that -classpath not looking for B.java , it is looking for any B.java classes (in this case A.class ).
I do not understand if both files are in the same package, why the compiler will not find A?