MCQs
Thread class is used to make threads in java, Thread encapsulates a thread of execution. To create a new thread the program will either extend Thread or implement the Runnable interface.
run() method is used to define the code that constitutes the new thread, it contains the code to be executed. start() method is used to begin execution of the thread that is execution of run(). run() itself is never used for starting execution of the thread.
Runnable
sleep()
getPriority()
In cases where two or more thread with same priority are competing for CPU cycles, different operating system handle this situation differently. Some execute them in time sliced manner some depending on the thread they call.
Thread exist in several states, a thread can be running, suspended, blocked, terminated & ready to run.
multithreaded programming a process in which two or more parts of same process run simultaneously.
isAlive() function is defined in class Thread, it is used for implementing multithreading and to check whether the thread called
upon is still running or not.
java.lang