<分区>
出现如下错误:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
No enclosing instance of type New is accessible. Must qualify the allocation with an enclosing instance of type New (e.g. x.new A() where x is an instance of New). at n.New.main(New.java:7)
以下是我的代码:
package n;
public class New
{
public static void main(String[] args)
{
Student a=new Student();
a.name="abc";
a.number=6;
a.marks=1;
System.out.println(a.name);
System.out.println(a.number);
System.out.println(a.marks);
}
class Student
{
String name;
int number;
int marks;
}
}