匿名内部类
public class TestThread3{ //静态方法 public static void S(ServiceOut s){ s.out(); } public static void main(String []args){ S(new Host()); } } //接口 interface ServiceOut{ void out(); } /*编写一个退出实现类*/ class Host implements ServiceOut{ @Override public void out() { System.out.println("電腦登陸失敗"); } }