编写一个静态内部类

 1 public class Staticlei
 2 {
 3     public int age = 20;
 4     public static int whit = 30;
 5     
 6     public void test()
 7     {
 8         System.out.println("test");
 9     }
10     public static void test1()
11     {
12         System.out.println("test1");
13     }
14     public static class lei//创建一个内部类
15     {
16         public int age = 40;
17         public static int whit = 50;
18         
19         public void test3()
20         {
21             int b=Staticlei.whit;
22             System.out.println("test3");
23         }
24         public static void test2()
25         {
26             
27             System.out.println("test2");
28         }
29     }
30     public static void main(String[] args)
31     {
32         Staticlei.lei lei = new Staticlei.lei();//创建一个内部类对象
33         Staticlei.lei.test2();//调用静态的内部类方法
34         lei.test3();//调用内部类的普通方法
35         System.out.println(lei.age);//调用成员变量
36         System.out.println(lei.whit);//调用成员变量
37         Staticlei.test1();//调用外部的静态方法
38         
39     }
40 }