Discuss / Java / 匿名类

匿名类

Topic source

InvocationHandler handler = new InvocationHandler() {

            @Override

            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

                System.out.println(method);

                if (method.getName().equals("morning")) {

                    System.out.println("Good morning, " + args[0]);

                }

                return null;

            }

        };


  • 1

Reply