/**
* run and start 区别
*/
public class StartAndRunMethod {
public static void main(String[] args) {
Runnable runnable = () ->{
System.out.println(Thread.currentThread().getName());
};
runnable.run();;
new Thread(runnable).start();
}
}
public class CantStartTwice {
public static void main(String[] args) {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
for (int i=0;i<3;i++){
System.out.println(Thread.currentThread().getName());
}
}
});
for (int i=0;i<3;i++){
thread.start();
}
}
}
https://www.cnblogs.com/zhaosq/p/10564698.html