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.
如何将PPT某一页幻灯片导出为高清图片
2.
Intellij IDEA中使用Debug调试
3.
build项目打包
4.
IDEA集成MAVEN项目极简化打包部署
5.
eclipse如何导出java工程依赖的所有maven管理jar包(简单明了)
6.
新建的Spring项目无法添加class,依赖下载失败解决:Maven环境配置
7.
记在使用vue-cli中使用axios的心得
8.
分享提高自己作品UI设计形式感的几个小技巧!
9.
造成 nginx 403 forbidden 的几种原因
10.
AOP概述(什么是AOP?)——Spring AOP(一)
本站公众号
欢迎关注本站公众号,获取更多信息
相关文章
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
>>更多相关文章<<