After java anonymous inner classes compiled in what will generate

public class Stu{

    interface A {
        void onTouch();
    }

    public A setTouch() {
        return new A() {

            @Override
            public void onTouch() {

            }
        };
    }

    public static void main(String[] args) {
        Stu stu = new Stu();
        stu.setTouch();
    }

}

javac generated after compilation
Write pictures described here
can be seen to generate a total of three class files. Port A generates a class file, generates a file Stu $ 1.class inner class

Guess you like

Origin blog.csdn.net/reuxfhc/article/details/81590997