public class Main{
public static void main(String args[]){
Thread t = Thread.currentThread();
System.out.println("Current thread" + t);
t.setName("My thread");
System.out.println("After changing thread name " + t);
try{
for(int i=5;i>0;i--){
System.out.println(i);
Thread.sleep(1000);
}
}catch(InterruptedException e){
System.out.println("Main Thread Interrupted");
}
}
}
Introduction To Thread
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment