创建内容类的方式通过外部类的实例对象来创建

public class AA {
     int a =1;
     class BB {
          int b=3 ;
     }
     public static void main(String[] args) {
          AA a =new AA();
          BB b=a.new BB();
          System.out.println(a.a);
          System.out.println(b.b);
     }
}


利用static修饰后,能够直接创建

public class AA {
     int a =1;
     static class BB {
          int b=3 ;
     }
     public static void main(String[] args) {
          AA a =new AA();
          BB b=new AA.BB();
          System.out.println(a.a);
          System.out.println(b.b);
     }
}