2020
10-10
10-10
利用Lambda表达式创建新线程案例
代码publicclassLamdaDemo{publicstaticvoidmain(String[]args){Runnabletask=()->{StringthreadName=Thread.currentThread().getName();System.out.println("Hello"+threadName);};task.run();Threadthread=newThread(task);thread.start();System.out.println("Done!");}}运行HellomainDone!HelloThread-0补充知识:java_Thread多线程创建和lambd...
继续阅读 >