Answer the question
In order to leave comments, you need to log in
I can't fix the error Exception Exception InterruptedException is not compatible with throws clause in Runnable.run(). Can you please explain?
When I wanted to create a thread with the Thread.sleep() method, I put throws InterruptedException in the signature of the main and run method and the error Exception InterruptedException is not compatible with throws clause in Runnable.run() came in, here is the whole code:
class new_thread implements
Runnable{
public void run ()throws
InterruptedException{
Thread.sleep(433);
}
}
public class Mainn {
public static void main(String [] args)throws InterruptedException{
Thread thread = new Thread(new new_thread());
thread.start();
Thread.sleep(33);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question