No enclosing instance of type  is accessible. Must qualify the allocation with an enclosing instance of type  (e.g. x.new A() where x is an instance of )

 

You can get the error,if you try to instantiate an inner class without an instance of the outer class.

reference site: http://stackoverflow.com/questions/3039306/how-can-i-create-a-new-class-instance-from-a-class-within-a-static-class

 

MyClass mc =newMyClass();
   
MyRelatedClass data = mc.newMyRelatedClass();
arrow
arrow
    全站熱搜

    Yuwan 發表在 痞客邦 留言(0) 人氣()