JavaShuo
欄目
標籤
「Main.this」 cannot be reference from a static context
時間 2021-07-14
標籤
java
成員內部類
欄目
Java
简体版
原文
原文鏈接
報錯的代碼如下: 記錄下錯誤原因,基礎知識理解不正確導致的。 原因: 1、上面的問題主要是因爲InnerClass是成員內部類,構造一個成員內部類對象時應使用: InnerClass cc = new Main().new InnerClass(); 2、或者可以使用靜態內部類,InnerClass加上static關鍵字,靜態內部類的創建不需要依賴外部類。
>>阅读原文<<
相關文章
1.
【踩坑】報錯 non-static method xxx() cannot be referenced from a static context
2.
報錯cannot be referenced from a static context的解決方法
3.
Cannot make a static reference to the non-static
4.
IDEA在主函數給其他傳遞參數出現「cannot be referenced from a static context」的解決方法
5.
Django context must be a dict ranther than Context
6.
fatal: 'origin/dev' is not a commit and a branch 'dev' cannot be created from it
7.
leaseEndDate: java.sql.Date cannot be assigned from null
8.
Cannot declare a variable of static type
9.
inject() must be called from an injection context
10.
【Eclipse】eclipse錯誤之Context root cannot be empty
更多相關文章...
•
XSL-FO static-content 對象
-
XSL-FO 教程
•
XSL-FO conditional-page-master-reference 對象
-
XSL-FO 教程
•
爲了進字節跳動,我精選了29道Java經典算法題,帶詳細講解
•
Tomcat學習筆記(史上最全tomcat學習筆記)
相關標籤/搜索
context
reference
static
a'+'a
core'&&cannot
cannot&nbs
reference.4
pointer&reference
a+aa+aaa+a...a
Java
0
分享到微博
分享到微信
分享到QQ
每日一句
每一个你不满意的现在,都有一个你没有努力的曾经。
最新文章
1.
css 讓chrome支持小於12px的文字
2.
集合的一點小總結
3.
ejb
4.
Selenium WebDriver API
5.
人工智能基礎,我的看法
6.
Non-local Neural及Self-attention
7.
Hbuilder 打開iOS真機調試操作
8.
improved open set domain adaptation with backpropagation 學習筆記
9.
Chrome插件 GitHub-Chart Commits3D直方圖視圖
10.
CISCO ASAv 9.15 - 體驗思科上一代防火牆
本站公眾號
歡迎關注本站公眾號,獲取更多信息
相關文章
1.
【踩坑】報錯 non-static method xxx() cannot be referenced from a static context
2.
報錯cannot be referenced from a static context的解決方法
3.
Cannot make a static reference to the non-static
4.
IDEA在主函數給其他傳遞參數出現「cannot be referenced from a static context」的解決方法
5.
Django context must be a dict ranther than Context
6.
fatal: 'origin/dev' is not a commit and a branch 'dev' cannot be created from it
7.
leaseEndDate: java.sql.Date cannot be assigned from null
8.
Cannot declare a variable of static type
9.
inject() must be called from an injection context
10.
【Eclipse】eclipse錯誤之Context root cannot be empty
>>更多相關文章<<