Originally posted by amit taneja:
i think in this ...we are not creating any new thread at all ...except main which exists...
in oreder to create thread we must create thread like
Thread a =new Thread(nt1);
is i m rt...i think there is no other way for creating thread...
how
nt1.start() will run ???
that is the second issue. Since we are not creating any object of the Thread class, we are not going to get any new threads either.
But given the code and the problem, the call to run() will be like a normal method call and go in an endless loop right there.
As to why it would compile, the call is a syntactically correct method call. The complier is not going to actually go through the run() method to find out that there is an endless loop and hence throw an Unreachable Statement Exception.