写代码被打死系列

interface Out{
}
class Outer {
    //成员内部类
    private String name ="123";
    private int id ;
        class inner{
            String name = Outer.this.name ;
            int id = Outer.this.id;
        }
        public Out test(int id )  {
            //局部内部类
            class inner2 implements Out{
                int id = Outer.this.id ;
                int id2 = this.id;
            }
            return new inner2();
        }
    public static void main(String[] args) {
        Outer outer = new Outer();
        inner inner = outer.new inner();
        Out test = outer.test(1);
    }
}
上一篇:开坑:mysql相关问题


下一篇:内部类