In Java, there are two ways to create threads:By implementing the Runnable interface and passing it to a Thread constructor.By extending the Thread class and overriding the run() method.The different states of a thread in Java are:New: When a thread is created but not yet started, it is in the new state.Runnable: When a thread is started, it enters the runnable state. In this state, it is ready to run but may not be currently executing.Running: When...
Showing posts with label different states of a thread. Show all posts
Showing posts with label different states of a thread. Show all posts