创建java类中类出现is not an enclosing class
来源:互联网 发布:现在有5g网络吗 编辑:程序博客网 时间:2024/05/22 03:15
记录一下开发中出现的问题
定义的bean中有嵌套的多个内部类
需要实例B类时,按照正逻辑是,A.B ab = new A.B();
那么编译器就会出现一个错误--"is not an enclosing class"
再翻看相关的java代码,发现原来写法出错了!正确的做法是
没有静态(static)的类中类不能使用外部类进行.操作,必须用实例来进行实例化类中类.
public class A { public class B { } };
需要实例B类时,按照正逻辑是,A.B ab = new A.B();
那么编译器就会出现一个错误--"is not an enclosing class"
再翻看相关的java代码,发现原来写法出错了!正确的做法是
A a = new A();A.B ab = a.new B();
没有静态(static)的类中类不能使用外部类进行.操作,必须用实例来进行实例化类中类.
0 0
- 创建java类中类出现is not an enclosing class
- 创建java类中类出现is not an enclosing class
- 创建java类中类出现is not an enclosing class
- 创建java类中类出现is not an enclosing class
- 创建java类中类出现is not an enclosing class
- class xxx is not an enclosing class
- Java错误提示is not an enclosing class
- intent时提示is not an enclosing class
- Android报错MainActivity is not an enclosing class
- Android Studio:xxx is not an enclosing class
- Android Studio:xxx is not an enclosing class 错误的解决方法
- Java出现No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing
- Java出现No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing
- Java出现No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing
- Java出现No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing
- Java出现No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing
- Java出现No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing
- Java出现No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing
- 数据压缩实验二 图像文件的读写和转换(bmp转yuv)
- 使用Struts2自带的验证出现的页面错误问题:No result defined for action action.UserAction and result
- content-type
- 滥用C++容器的教训:vector和set的查找效率问题
- 查看定时任务的执行情况
- 创建java类中类出现is not an enclosing class
- Java多态机制
- 笔记:FFMPEG 中的几个不同的 time_base
- logback滚动输出压缩格式的文件
- MongoDB: No server chosen by ReadPreferenceServerSelector
- 极光推广
- 3141218.html
- leecode 之 longestcommonprefix
- 按时分秒延时函数 OSTimeDlyHMSM()