当前位置: 代码迷 >> 综合 >> No enclosing instance of type fs is accessible. Must qualify the allocation with an enclosing instan
  详细解决方案

No enclosing instance of type fs is accessible. Must qualify the allocation with an enclosing instan

热度:0   发布时间:2024-01-18 18:25:03.0

我写的内部类以public class开头是动态的。而主程序是public static class main。在Java中,类中的静态方法不能直接调用动态方法。只有将某个内部类修饰为静态类,然后才能够在静态类中调用该类的成员变量与成员方法。所以在不做其他变动的情况下,最简单的解决办法是将public class改为public static class.

 

  相关解决方案