This code is working fine but if I use the constructor Thread(name) in 6th line instead of Thread(this,name) it is not working I just want to know what makes the difference?
public class threadtest implements Runnable{
Thread t;
public threadtest(String name)
{
System.out.println("satheesh");
Thread t=new Thread(this,name);
t.start();
t=null;
//System.out.println(this+"\n"+t);
}
public void run(){
System.out.println("satheesh");
for(int i=0;i<=10;i++)
{
try{
System.out.println("satheesh");
Thread.sleep(1000);
System.out.print(Thread.currentThread());
}
catch(Exception e)
{
System.out.println(e);
}
}
}
public static void main(String args[])
{
threadtest ob=new threadtest("satheesh");
}
}