No enclosing instance of type Test_02_1 is accessible. Must qualify the allocation with an enclosing

main是Test_02_1類的static方法,按照常理它只能訪問Test類中static資源,而class A是非static所以報錯了。解決方法很簡單,給class A添加static屬性就可以了。 static class A{}
相關文章
相關標籤/搜索