hi all..
I am trying this code:
class v extends Thread{
public void run() {
System.out.print("go ");
}
public static void main(
String [] args){
try
{
Thread t1 = new v();
Thread t2 = (t1);
t1.start();
t2.start();
}
catch(Exception e)
{System.out.println(e);}
}
}
output
D:\>
java v
java.lang.IllegalThreadStateException
go
I am confused from this output ... If we invoked start() again on the same Thread obj... it will throw IllegalThreadStateException.. but how come after the exception is thrown it is printing the "go"... the program should get terminated.
So if the firstly started thread gets the chance to run it should print "go " and then the exception or only the exception... how come it is printing a message from run() after an exception is thrown..???
please send some explanation..Thanks