import PPP.*;
public class Main{
public static void main(String args[]){
PP obj=new PP();
obj.Show();
}
}
这个简单的程序会出错:
cannot access PP where PPP(Package) only contains a class file (PP.class) and it's on desktop
also Main.java is on desktop.
答案 0 :(得分:0)
你必须在你的班级PP
中找到package PP;
这是您修改后的代码
package PPP;
public class PP
{
public static void main(String...a)
{
System.out.println("hello");
}
public void show()
{
System.out.println("hello");
}
}
这里是你的主要课程
import PPP.*;
public class Main{
public static void main(String args[]){
PP obj=new PP();
obj.show();
}
}
它会帮助你