|
答案是C,因为我忘记删除class下所有的同名class了。。呵呵
C is correct. In order for B.java to compile, the compiler first needs to be able to find B.java. Once it's found B.java it needs to find A.class. Because A.class is in the xcom package the compiler won't find A.class if it's invoked from the xcom directory. Remember that the -classpath isn't looking for B.java, it's looking for whatever classes B.java needs (in this case A.class).
c是对的,为了让B.java编译,编译器首先要找到B.java,一旦找到B.java,就要去找A.class。因为A.class在包xcom下,编译器找不到A.class 如果从xcom目录下调用的话。记住-classpath不寻找B.java,他寻找所有B需要的(A.class)
A, B, and D are incorrect based on the above. E is incorrect because the compiler can't find B.java. (Objective 7.2)
但是A.class和B.class同在包xcom下。。。。如果当前编译也在xcom下,这跟javac的工作机制就矛盾了,因为javac要在super directory of xcom....终于找到问题了!!!
感谢大家!!!!!!!!!! |
|