标签:and handle style handler public pre vat sys 实现
import java.util.ArrayList; public class HandlerDemo{ public static void main(String[] args) { ArrayList<Object> list = new ArrayList<>(); // 测试匿名类实现doBusy方法 new HandlerDemo().testHandler(() -> { list.add("测试匿名类实现doBusy方法"); }); System.out.println(list); } //调用接口方法 private void testHandler(Handler handler) { handler.doBusy(); } } public interface Handler { void doBusy(); }
标签:and handle style handler public pre vat sys 实现
原文地址:https://www.cnblogs.com/Lambquan/p/12090717.html