This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I know it takes time for explaining me these questions........please help me...
Simply, as mentioned by other ranchers, if the thread is doing a wait(), sleep(), join(), etc., then an InterruptedException will be thrown.
Also, if the thread is doing IO, and the platform supports interrupted IO (such as windows), then an InterruptedIOException will be thrown.
Otherwise... it is cooperative. The thread must check the state of the interrupt flag, and deal with it. If the thread doesn't check the flag, and doesn't do any operation that can throw an InterruptedException, then nothing will happen differently -- which is what is happening with this example.
Thank you friends for your good explanations and examples.
I have understood that on being interrupted thread leaves what it is currently doing such as sleeping , waiting or doing specific I/O operations,but still it is runnable and can execute its normal instructions, as it is doing in above examples.....
Please tell me I am right or wrong...if wrong then where...??