Thread t = new Thread(() -> { for (int i = 0; i < 5; i++) { System.out.println(Thread.currentThread().getName() + " " + i); System.out.println("Hello world"); } }); t.start();2.Runnable接口
Runnable r = () -> { for (int i = 0; i < 5; i++) { System.out.println(Thread.currentThread().getName() + " " + i); System.out.println("Hello world"); } }; r.run();
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)