Java_Labprogram_11
Java_Labprogram_11
of the newly created thread. Inside the run method there is sleep() for suspend the thread for 500
milliseconds)
Solution:-
try
Thread.sleep(500);
catch (InterruptedException e)
int numThreads = 5;
thread.start();
Output:
Thread 10 is running.
Thread 12 is running.
Thread 14 is running.
Thread 13 is running.
Thread 11 is running.