public class Demo02 {
public static void main(String[] args) {
Test01();
new Thread(){
public void run(){
System.out.println(getName()+".......ccccccccccc");
}
}.start();
new Thread( new Runnable(){
public void run(){
//Thread.currentThread()獲取當前正在執行的線程
System.out.println(Thread.currentThread().getName()+"dddddddddd");
}
}).start();
System.out.println(Thread.currentThread().getName());//獲取主線程的名字
Thread.currentThread().setName("我是主線程");
System.out.println(Thread.currentThread().getName());//再次獲取主線程的名字
}