No enclosing instance of type testTry is accessible. Must qualify the allocation...之解决方法
报错原因:
因为在做异常处理测试时,我写的内部类是动态的,即public class开头无static关键字修饰,而测试主程序是静态的main方法;在Java中,类中的静态方法不能直接调用动态方法。只有将某个内部类修饰为静态类,才可以在静态类中调用带类的成员变量和成员方法:
解决方法:
将动态内部类改为静态(public static class)即可:
No enclosing instance of type testTry is accessible. Must qualify the allocation...之解决方法相关推荐
- No enclosing instance of type SmsUtils is accessible. Must qualify the allocation with an enclosing
No enclosing instance of type SmsUtils is accessible. Must qualify the allocation with an enclosing ...
- Java出现No enclosing instance of type Test is accessible. Must qualify the allocation with an enclosin
最近研究LDA源代码时,里面涉及到Comparable方法的使用.以前用过这个排序方法,现在想回顾一下.以下是程序,感觉没问题啊,结果报错了: Exception in thread "ma ...
- No enclosing instance of type FormDetailBean is accessible. Must qualify the allocation with an encl
最近在看Java,在编译写书上一个例子时,由于书上的代码只有一部分,于是就自己补了一个内部类.结果编译时出现:No enclosing instance of type E is accessible ...
- No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing instanc
java : No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing ...
- 语法错误:No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing
错误 问题 No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing 没 ...
- No enclosing instance of type TextRunnable is accessible. Must qualify the allocation with an enclo
今天写demo的时候,遇到一个问题,关于内部类的,这里写一下 错误信息:No enclosing instance of type TextRunnable is accessible. Must q ...
- [Java]Error:No enclosing instance of type E is accessible. Must qualify the allocation with an enclo
在自己试着写一个链表的例子时,由于参考的代码只有一部分,于是就自己补了一个内部类.结果编译时出现:No enclosing instance of type E is accessible. Must ...
- No enclosing instance of type X is accessible. Must qualify the allocation with an enclosing instanc
No enclosing instance of type X is accessible. Must qualify the allocation with an enclosing instanc ...
- No enclosing instance of type Main is accessible. Must qualify the allocation with an enclosing i...
最近在刷AC,在编译时出现: No enclosing instance of type Main is accessible. Must qualify the allocation with an ...
最新文章
- 浅谈Python flask框架浅析
- Linux下使用NTFS格式移动硬盘
- 机器学习算法-Adaboost
- Elementui动态换肤
- 实例1.1:通过HWND获得CWnd指针
- [转]基于SQL Server 2008 Service Broker构建企业级消息系统
- CSS3动画框架 Animate.css
- 手把手教你Tiny4412 Android5.0 定制 按下开发板上的按键通过广播发送到应用层
- 如何在windows上搭建DZ(Discuz!)论坛?
- 摄影系列:李涛ps视频教程笔记
- ios 越狱后 重启springboard 命令
- python实现——WORD转PDF(全自动化,支持doc、docx)
- 文本摘要(text summarization)任务:研究范式,重要模型,评估指标(持续更新ing...)
- 如果兔子拼命奔跑 乌龟怎么办
- 值得看三次的高干文_5本精彩的高干文推荐,本本是经典,值得刷三遍以上!...
- python 3 12306余票查询脚本
- php英文随机验证码,PHP随机字母数字验证码
- 使用jQuery用键盘去控制图片移动
- SSM框架自学笔记--------巨细!!!!!!!!
- 经济危机为什么也是创业良机?