线程有name的属性,为什么线程自定义的名字运行还是显示Thread-0呢?
class Xian extends Thread{
private String name;
Xian(String name){
this.name=name;
}
public void run(){
for(int x=0;x<99;x++){
System.out.println(Thread.currentThread.getName()+"hahaha,heihei,hiahiahia");
}
}
}
---------------------------------------------------------------
mian(String[] args){
Xian x= new Xian("1号线程");
x.start();
} |
|