Java在静态方法中直接调用了动态方法出现错误
2016-11-09 11:22
393 查看
Java
静态方法里面如果使用直接调用那么被调用也必须是静态的。
且被调用的子调用方法也必须是静态的,否则会出现
No enclosing instance of type bestLoading is accessible. Must qualify the allocation with an enclosing instance of type bestLoading (e.g. x.new A() where x is an instance of bestLoading).
解决方案:在主函数中实例化对象调用动态方法。
静态方法里面如果使用直接调用那么被调用也必须是静态的。
且被调用的子调用方法也必须是静态的,否则会出现
No enclosing instance of type bestLoading is accessible. Must qualify the allocation with an enclosing instance of type bestLoading (e.g. x.new A() where x is an instance of bestLoading).
解决方案:在主函数中实例化对象调用动态方法。
相关文章推荐
- java中静态方法中为什么不能使用this、super和直接调用非静态方法
- Java多态及静态方法对动态方法的调用
- JAVA 反射 动态调用不同类的静态方法
- .NET调用Java方法时出现的一个错误及其原因
- java的静态方法可以直接用类名调用的理解
- 类中的静态方法不能直接调用动态方法
- 通过el表达式配置使jsp直接调用java静态方法
- java 程序加载过程---3--类中申明同时申明类的静态对象 创建类的实例 访问类的静态变量 调用类的静态方法 使用反射方法 初始化类的子类对象 直接使用java.exe 调用某个类
- java用jni调用dll动态库出现Can't find dependent libraries问题的解决方法
- 静态方法调用非静态方法——编译出现错误
- java中为什么类名可以直接调用静态方法?
- Java中可以直接调用类中静态方法,不用实例化
- 每当使用struts2动态方法调用时,总是出现错误:There is no Action mapped for namespace [/user] and action name [user!add]
- Play tag标签,模板、tag中直接调用后台静态java方法
- myeclipse中调试调用带有静态代码块的类时出现java.lang.NoClassDefFoundError的处理方法
- day59(5.9)程序报错类型之类中的静态方法不能直接调用动态方法
- delphi dll 静态调用和动态调用方法总结
- bcb平台的C++dll的静态调用法和动态调用法的方法
- java web JNative调用dll动态链接库:和注意方法
- 当您调用的 RDA 对象的拉方法时出现错误消息:"重复的值不能插入唯一索引。[表名 = __sysRDASubscriptions,约束名 = c_LocalTableName]"