代碼
提交代碼
public class LambdaDemo1 {
public static void main(String[] args) {
// 實(shí)例化一個(gè) Runnable 接口的匿名實(shí)現(xiàn)類對(duì)象
Runnable runnable = new Runnable() {
@Override
public void run() {
System.out.println("Hello, 匿名內(nèi)部類");
}
};
// 執(zhí)行匿名內(nèi)部類的 run() 方法
runnable.run();
}
}
運(yùn)行結(jié)果