when does the thread.sleep generate InterruptedException? I am using this but exception not occuring.Please help about using threads. about passing information to thread and returning information from thread.
public class myThread extends Thread{
@Override
public void run(){
try{
while(true) {
Thread.sleep(200);
System.out.println("Thread is running");
}
}
catch(InterruptedException ex){
System.out.println("Exception Occur");
}
}
exception does not occur after 200ms. why??
As I know, InterruptedException is generated when you try to kill/interrupt the thread that is sleeping.