您的位置:首页 > 编程语言 > Java开发

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

  解决方案:在主函数中实例化对象调用动态方法。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐