sleep from main thread is throwing InterruptedException

前端 未结 3 2030
后悔当初
后悔当初 2021-01-04 12:52

I have the main thread of execution which spawns new threads. In the main thread of execution in main() I am calling Thread.sleep(). When do I get an Unhand

3条回答
  •  隐瞒了意图╮
    2021-01-04 13:20

    At the line where you're definition of main starts, just include throws Exception. I too was facing similar problem, and this helped. After this inclusion, you need not include the Thread.sleep(xx); inside a try-catch statement

提交回复
热议问题