No enclosing instance of type Outer is accessible.
No enclosing instance of type Outer is accessible. Must qualify the allocation with an enclosing
instance of type Outer (e.g. x.new A() where x is an instance of Outer).
錯誤顯示:沒有可訪問的內部類的例項,必須分配一個合適的內部類的例項
錯誤原因:非靜態內部類方法不能被靜態內部類呼叫,必須修飾為靜態類才可以
解決方法:將內部類修飾為static
instance of type Outer (e.g. x.new A() where x is an instance of Outer).
點選(此處)摺疊或開啟
-
class Outer {
-
class Inner {
-
}
-
public static void foo() {
-
new Inner();
-
}
-
public void bar() {
-
new Inner();
-
}
-
public static void main(String[] args) {
-
new Inner();
-
}
- }
錯誤顯示:沒有可訪問的內部類的例項,必須分配一個合適的內部類的例項
錯誤原因:非靜態內部類方法不能被靜態內部類呼叫,必須修飾為靜態類才可以
解決方法:將內部類修飾為static
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30046312/viewspace-2143543/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 再學Java 之 解決No enclosing instance of type * is accessibleJava
- asmcmd: command disallowed by current instance typeASM
- 關於"asmcmd: command disallowed by current instance type"問題解決ASM
- 外連線(outer join)示例
- jQuery之height()、innerHeight()、outerjQuery
- 理解full outer jion,union,union all
- outer join新舊語法分析語法分析
- Leetcode - Smallest Rectangle Enclosing Black PixelsLeetCode
- Swift:Errors thrown from here are not handled because the enclosing catch is not exhaustiveSwiftError
- Python Enclosing作用域、裝飾器話聊上篇Python
- LeetCode-Smallest Rectangle Enclosing Black PixelsLeetCode
- variable: Type 與 Type variable
- cannot convert (type interface {}) to type int: need type assertion
- Value Type vs Reference Type in SwiftSwift
- instance和clientclient
- Oracle database instanceOracleDatabase
- The Instance and the Database (285)Database
- STATUS OF ORACLE INSTANCEOracle
- Python Enclosing作用域、閉包、裝飾器話聊下篇Python
- Inner Join, Left Outer Join和Association的區別
- 使用Partitioned Outer Join實現稠化報表
- CROSS APPLY 和outer apply 的區別ROSAPP
- 理解Database和InstanceDatabase
- Monitoring an SAP instance
- BIEE Instance OracleBIPresentat DownOracle
- Overview of Instance and Crash RecoveryView
- Oracle instance解釋Oracle
- shape_trans 凸性轉換 outer_circle
- Lerning Entity Framework 6 ------ Joins and Left outer JoinsFramework
- Type in Chakra
- HITSC_4_Data Type and Type Checking
- [20171002]NESTED LOOPS(PARTITION OUTER).TXTOOP
- 3.2.1 Mounting a Database to an InstanceDatabase
- C++ instance的使用C++
- object is not an instance of declaring classObject
- Introduction to an Oracle Instance (284)Oracle
- Overview of Instance and Database Startup (289)ViewDatabase
- Restricted Mode of Instance Startup (291)REST