出现No enclosing instance of type is accessible解决方法
No enclosing instance of type hello is accessible. Must qualify the allocation with an enclosing instance of type hello (e.g. x.new A() where x is an instance of hello).
检查一下自己一个文件多个类的写法是否正确
一个文件只能有一个类是public,
其他类调用一个文件的非public类时候可以用“包名.类名”
public class Test{
public static void main(String args[]){
new B();
}
}
class A {
public A(){
System. out.println("I am A" );
}
}
class B extends A{
public B(){
System. out.println("I am B" );
}
}