有两点区别
- 静态内部类可以直接创建实例,而非静态必须要创建一个父类的实例之后才能创建子类的实例
- 静态内部类只能访问父类的静态资源,而非静态可以访问所有资源
/* Java program to demonstrate how to implement static and non-static
classes in a java program. */
class OuterClass{
private static String msg = "GeeksForGeeks";
// Static nested class
public static class NestedStaticClass{
// Only static members of Outer class is directly accessible in nested
// static class
public void printMessage() {