sagar shroff wrote:Consider i have 1 Thread and i started it.In the run method when i call interrupt () on that Thread nothing happens.In java Docs it is simply written that it interrupts the Thread.
Can Someone explain me what does interrupt () do and what is the us of it ??
This was the code which i tried and the Output was
Seetharaman Venkatasamy wrote:if you call interrupt on a thread, then that thead status set to true. this is one of the technique used to stop a thread. if that Thread sleep or wait then , it throws InterruptedException.
so, just print Thread.currentThread.isInterrupted() return value and check
Thank you Seetharam So Much !!! . I really Appreciate you