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.
android 以太网和wifi共存
2.
没那么神秘,三分钟学会人工智能
3.
k8s 如何 Failover?- 每天5分钟玩转 Docker 容器技术(127)
4.
安装mysql时一直卡在starting the server这一位置,解决方案
5.
秋招总结指南之“性能调优”:MySQL+Tomcat+JVM,还怕面试官的轰炸?
6.
布隆过滤器了解
7.
深入lambda表达式,从入门到放弃
8.
中间件-Nginx从入门到放弃。
9.
BAT必备500道面试题:设计模式+开源框架+并发编程+微服务等免费领取!
10.
求职面试宝典:从面试官的角度,给你分享一些面试经验
本站公众号
欢迎关注本站公众号,获取更多信息
相关文章
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
>>更多相关文章<<