关于PACKAGE的问题
我有一事不明!
我的
classpath=.;d:\j2sdk\lib\dt.jar;d:\j2sdk\lib\tool.jar;d:\javapro;
可是当我在JAVAPRO的目录下写了一个文件如
//:pa1:P.java
//
package pa1;
public class P{
P(){
}
public void rint(String s){
System.out.print(s);
}
public void rintln(String s){
System.out.println(s);
}
}///:~
//: Tooltest.java
//
import pa1.P;
public class Tooltest{
public static void main(String[] args){
P p = new P();
p.rintln("12321");
p.rint("fld");
}
}
以上是可以运行的
但是为什么用
import pa1.*;
就不行呢?出错提示如下“
D:\javapro\Tooltest.java:7: cannot access P
bad class file: D:\javapro\P.java
file does not contain class P
Please remove or make sure it appears in the correct subdirectory of the classpath.
P p = new P();