package java_learning;
public class test_Thread {
public static void main(String[] args) {
Thread t = Thread.currentThread();
System.out.println("Current thread: " + t);
//change the name of the thread
t.setName("my thread");
System.out.println("after name change:"+t);
try{
for(int n=5; n>0; n--){
System.out.println(n);
Thread.sleep(1000);
}
}catch(InterruptedException e ){
System.out.println("my threah interrupted!");
}
}
}
test_Thread
最新推荐文章于 2022-07-11 16:33:26 发布