出现No enclosing instance of type Exp is accessible. Must qualify the allocation with an enclosing ins
2016-09-22 11:10
711 查看
在进行实现接口的时候出现错误:No enclosing instance of type Exp is accessible. Must qualify the allocation with an enclosing instance of type Exp (e.g. x.new A() where x is an instance of Exp).如何处理。汉译:为没有可访问的内部类Exp的实例,必须分配一个合适的内部类Exp的实例(如x.new A(),x必须是Exp的实例。)Exp内部类是动态的,也就是开头以public
class开头。而主程序是public static class main。在Java中,类中的静态方法不能直接调用动态方法。只有将某个内部类修饰为静态类,然后才能够在静态类中调用该类的成员变量与成员方法。
方法一:在不做其他变动的情况下,最简单的解决办法是将public class改为public static class。
方法二:在Exp类外进行定义。
class开头。而主程序是public static class main。在Java中,类中的静态方法不能直接调用动态方法。只有将某个内部类修饰为静态类,然后才能够在静态类中调用该类的成员变量与成员方法。
方法一:在不做其他变动的情况下,最简单的解决办法是将public class改为public static class。
方法二:在Exp类外进行定义。
相关文章推荐
- 搭建PXE服务器,推送安装linux系统
- 第四周 项目3 -2
- Android4.4深入浅出之SurfaceFlinger总体结构
- JQuery开发之Galleriffic图片插件介绍
- 第四周项目3(1)-结点逆置
- 第四周项目三并联电路总电阻
- 第三周-项目四-顺序表应用
- vs2012快捷键
- 居家装修这些细节一定得注意到
- 第四周项目三 单链表应用-连接
- window对象
- Php5.5新特性 Generators详解
- Android 引导页,可定制性强
- python挑战之level 12
- Android中的XML和JSON
- Contains Duplicate
- 星号拼字母
- MIL for PRE
- android 提高App启动速度
- PHP使用星号隐藏用户名,手机和邮箱的实现方法