No enclosing instance of type JDStudent is acAcessible. Must qualify the allocation with an enclosing instance of type JDStudent (e.g. x.new A() where x is an instance of JDStudent).

E(e.g. x.new A() where x is an instance of E). E指代我写的那个内部类。
根据提示,没有可访问的内部类E的实例,必须分配一个合适的内部类E的实例(如x.new A(),x必须是E的实例。)看着这句提示,我就纳闷了,我已经用new实例化了这个类,为什么还不行呢。
于是百度谷歌了一下相关资料。原来我写的内部类是动态的,也就是开头以public class开头。而主程序是public static class main。在Java中,类中的静态方法不能直接调用动态方法。只有将某个内部类修饰为静态类,然后才能够在静态类中调用该类的成员变量与成员方法。所以在不做其他变动的情况下,最简单的解决办法是将public
class改为public static class.
今天记录下来

No enclosing instance of type JDStudent is acAcessible. Must qualify the allocation with an enclosin相关推荐

  1. Java出现No enclosing instance of type Test is accessible. Must qualify the allocation with an enclosin

    最近研究LDA源代码时,里面涉及到Comparable方法的使用.以前用过这个排序方法,现在想回顾一下.以下是程序,感觉没问题啊,结果报错了: Exception in thread "ma ...

  2. 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 ...

  3. No enclosing instance of type FormDetailBean is accessible. Must qualify the allocation with an encl

    最近在看Java,在编译写书上一个例子时,由于书上的代码只有一部分,于是就自己补了一个内部类.结果编译时出现:No enclosing instance of type E is accessible ...

  4. 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 ...

  5. 语法错误: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 没 ...

  6. 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 ...

  7. [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 ...

  8. 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 ...

  9. 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 ...

最新文章

  1. numpy 中的 squeeze() 函数
  2. Android NDK学习(3)使用Javah命令生成JNI头文件 .
  3. Cloud for Customer Fiori client导航栏里工作中心层级显示设定
  4. SpringBoot2 参数管理实践,入参出参与校验
  5. View、Text、Button的drawableLeft左侧图片自定义大小
  6. 【Python】学习笔记之列表生成式
  7. c语言 rbinom函数,R语言系列:常见离散分布及相关函数
  8. 关于STM32系列单片机中断触发时间问题
  9. 转SQLSERVER 会不会自动加锁
  10. 比特币总量是2100万吗?为什么?
  11. 文本属性之装饰文本(CSS、HTML)
  12. 【Zookeeper学习】Apache Zookeeper项目简介
  13. javascript学习5
  14. 一维数组与二维数组的区别
  15. 故事版(storyBoard)-lllegal configuration connection object cannot have a prototype objct as
  16. linux裸设备文件系统,关于裸设备,文件系统,CIO/DIO
  17. 在sublime中插入图片
  18. matlab 如何axis,在matlab中axis是什么意思,matlab中axis的用法
  19. 后缀数组+贪心+隔板法
  20. 不用写软件,纯JS 实现QQ空间自动点赞

热门文章

  1. 电脑的基础知识_电脑键盘功能基础知识
  2. QT5.14 VS2019
  3. ui kit html,开始使用
  4. c语言 两个文件相似度比较,某课程设计---文件相似度判断
  5. 支持javascript的ppt软件_github重磅推荐!一个很好用的PPT生成工具
  6. 目前流行的装修风格_当下最流行十种装修风格,总有一款适合你!
  7. thinkphp导入css失败,为什么用thinkphp总是提示css错误?
  8. go 自定义error怎么判断是否相等_Go Web 小技巧(二)GORM 使用自定义类型
  9. java jtable 监听事件_【Java】在JTable中设置鼠标监听器,点击操作对应数据
  10. python教程怎么抓起数据_介绍python 数据抓取三种方法