@aye_balbec

Не могу исправить ошибку Exception Exception InterruptedException is not compatible with throws clause in Runnable.run().Можете, пожалуйста объяснить?

Когда хотел создать поток с методом Thread.sleep() поставил в сигнатуре метода main и run throws InterruptedException и ввшла ошибка Exception InterruptedException is not compatible with throws clause in Runnable.run(), вот весь код:
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);
}
}
  • Вопрос задан
  • 65 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
24 апр. 2024, в 22:30
200000 руб./за проект
24 апр. 2024, в 22:11
2000 руб./за проект
24 апр. 2024, в 21:49
10000 руб./за проект