//
package com.egov.builder.nbn;
public interface A {
public void doSomething();
}
package com.egov.builder.nbn;
public class B {
public void fun(A a){
System.out.println("fun");
a.doSomething();
}
}
package com.egov.builder.nbn;
public class T {
/**
* @Methodname: main
* @Discription: TODO
* @param args
* @Return: void
* @Throws
*
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
B b = new B();
b.fun(new A(){
public void doSomething() {
System.out.println("匿名内部类");
}
});
}
}
匿名内部类
最新推荐文章于 2024-07-20 14:39:06 发布