Java包访问权限问题
锦瑟six 2014-03-10 11:55:44 放在同一个包中的两个类:
package packages.testpackage;
public class ClassOfProtected{
protected void printMe(){
System.out.println("I'm protected!");
}
public void printOthers(){
System.out.println("I'm public!");
}
}
package packages.testpackage;
public class Test1{
public static void main(String[] args){
ClassOfProtected cop = new ClassOfProtected();
cop.printOthers();
}
}
Test1运行时提示错误信息:Exception in Thread "main" java.lang.NoClassDefFoundError:Test1(wrong name:packages/testpackage/Test1)
求教