i know this is a very basi doubt but just wanted to clarify.
We know that for making a
thread run, you call the start method and then invoke the run() method. But can a thread start running without callin the start() method.
For example the foll code compiles cleanly.
public class NiceThreads implements Runnable
{
public void run()
{
while(true)
{
}
}
public static void main(
String args[])
{
NiceThreads nt1 = new NiceThreads();
NiceThreads nt2 = new NiceThreads();
NiceThreads nt3 = new NiceThreads();
nt1.run();
nt2.run();
nt3.run();
}
}
I thought it wont compile as you havent set the start() method.
Please clarify.