Why does a sleep thread need a try catch to catch Interrupted Exception?
Why does a sleep even emit an Interrupted Exception error?
This are the two questions I really wanna find out about in java programming
I’ve been searching through google and i’ve still haven’t found a clear explanation is to why this two things happen.
Because a Thread cant complete its normal execution if you Interrupt it, and you need to catch that in order to be prepared to do something.
Because a thread waiting is different from an interrupted thread, a thread waiting can be resumed, but an interrupted thread is already finish execution.