Threads
class Libin implements Runnable{
Thread T1;
public Libin(){
}public Libin(String Name){
T1=new Thread(this,Name);
T1.start();
}
public void run(){
System.out.println(Thread.currentThread());
}
}
public class Bijo{
public static void main(String[] args){
Thread S1=new Thread(new Libin(),"CT");
Thread S2=new Thread(new Libin(),"Chibanayil");
Libin d1=new Libin("class mate");
S1.start();
S2.start();
try{
System.out.println("The Name of the thread" Thread.currentThread());
Thread.currentThread().sleep(2000);
}catch (InterruptedException e){
System.out.println(" ");
}
}
}
1. In this program i get an output of this
Thread[class mate,5,main]
Thread[Chibanayil,5,main]
The Name of the threadThread[main,5,main]
Thread[CT,5,main]
is any problem in this output?,is it a genuine program the print statement of the main class is executed at third position,what is the reason please
help me