package com . neu . day02 ; /** * @Author yqq * @Date 2022/03/27 16:29 * @Version 1.0 */ public class Thread01 { public static void main ( String [] args ) { //new Thread() new Thread (){ @Override public void run () { System . out . printl
/**
* @Author yqq
* @Date 2022/03/27 16:29
* @Version 1.0
*/
public class Thread01 {
public static void main(String[] args) {
//new Thread()
new Thread(){
public void run() {
System.out.println(Thread.currentThread().getName());
}
}.start();
//new Thread(Runnable target)
new Thread(new Runnable() {
public void run() {
System.out.println(Thread.currentThread().getName());
}
}).start();
//new Thread(Runnable target,String name)
new Thread(new Runnable() {
public void run() {
System.out.println(Thread.currentThread().getName());
}
},"name0").start();
//new Thread(String name)
new Thread("name1"){
public void run() {
System.out.println(Thread.currentThread().getName());
}
}.start();
}
}