我有以下代码:
class Hello {
class Thing {
public int size;
Thing() {
size = 0;
}
}
public static void main(String[] args) {
Thing thing1 = new Thing();
System.out.println("Hello, World!");
}
}
Run Code Online (Sandbox Code Playgroud)
我知道Thing什么都不做,但我的Hello,World程序在没有它的情况下编译得很好.这只是我定义的类失败了.
它拒绝编译.我开始No enclosing instance of type Hello is accessible."创造一个新的东西.我猜是:
有任何想法吗?