51,408
社区成员
发帖
与我相关
我的任务
分享独立文件1: public class Student{
String name;
}
独立文件2:public class StudentTest{
public static void main(String [] args){
Student s1 =new Student();
System.out.print(s1.name);
}
}
运行报错内容:Exception in thread "main" java.lang.IllegalAccessError: class StudentTest tried to access field Student.name (StudentTest is in unnamed module of loader com.sun.tools.javac.launcher.Main$MemoryClassLoader @2473b9ce; Student is in unnamed module of loader 'app')
at StudentTest.main(StudentTest.java:4)