静态方法到底能不能存在于非静态类中?


public class Test3 {
    public static void main(String[] args) {
        Outer.Inner.show();
    }
}

class Outer{
    static class Inner{
        public static void show(){
            System.out.println("Inner..show");
        }
    }
}

在内部类Inner中创建静态方法,Inner会报错,用static修饰之后就不报错了。

疑惑1:静态方法可以存在于非静态类中,那为什么这里内部类Inner需要用static修饰啊?
疑惑2:内部类Inner需要用static修饰,那为啥外部类Outer不需要static修饰?

自学才没多久,感谢指导~