public class ThreadDemo extends
Thread {
public void run()
{
System.out.println("thread statred");
try
{
Thread.sleep(20000);
System.out.println("I am back from my sleep");
}
catch(InterruptedException e)
{
System.out.println("I got interrupted");
}
}
}
The option's are as follow's
1)Exactly 20 second's after the start method is called"I am back from my sleep" is printed"
2)we can be sure that atleast after 20 seconds elapsed, "I am back from sleep"will be printed.
3)The delay between ouytput "Thread started "and "I am back from sleep "is less or more than 20 seconds.
4)None of the above.
Th answer given is (2) and i chose 4.Please tell me the correct answer.
When a sleeping thread wake's up then it will go to the ready state.In that state it is totally up to the scheduler when it put that thread in the runnable state.Then How can a (2)option be correct?.Please tell me.