unreported exception java.lang.InterruptedException when performing Thread.Sleep()
I am working on a program, where i need to handle multiple threads asynchronously. But in order to set the proper sequence of code execution and maintaining it i need to use the Thread.Sleep function or the wait function alternatively. but whenever i use any of them, i am facing an error as
unreported exception java.lang.InterruptedException; must be caught or declared to be thrown.
I had referred to enormous articles from compile errors to exception handling, threading and thread interuptions but cant understand what is wrong with the usage of these functions. Now i am exploring are there any steps required to be executed prior of using functions like these ?? If so pls let me know what are they and how to use them.