No enclosing instance of type X is accessible. Must qualify the allocation with an enclosing instance of type X(e.g. x.new A() where x is an instance of X)
写代码时一直包这个错误,也没有在意,第一次查了下资料找到原因了,就算了!可后面有出现一次,所以一定要记下来!
这个的原因是内部类的问题,如果你的主类(MainClass)是static,那么你的内部类也必须是static,好比静态方法中调用的全局变量也必须是静态的一样!