Thread isAlive() Method in Java With Examples Last Updated : 09 May, 2022 Suggest changes Share Like Article Like Report Thread class in java provides numerous methods that are very essential in order to understand the working of threads as the thread stages are triggered by them. Java multi-threading provides two ways to find with the help of isAlive() and join() method.One thread gets to know when another thread has ended. Let us do depict stages of the lifecycle of the thread via the below image which helps us to connect dots to understand these methods' workings. Now let us do discuss isAlive() method of Thread class to a deeper depth. Basically, this method works internally very closely in parallel to the lifecycle stages of a thread. It tests if this thread is alive. A thread is alive if it has been started and has not yet died. There is a transitional period from when a thread is running to when a thread is not running. After the run() method returns, there is a short period of time before the thread stops. If we want to know if the start method of the thread class has been called or if the thread has been terminated, we must use the isAlive() method. This method is used to find out if a thread has actually been started and has yet not terminated. Syntax: final boolean isAlive() Return Value: Boolean value returns Note: While returning this function returns true if the thread upon which it is called is still running. It returns false otherwise. Example Java // Java program to Illustrate isAlive() Method // of Thread class // Main class extending Thread class public class oneThread extends Thread { // Method 1 // run() method for thread public void run() { // Print statement System.out.println("geeks "); // Try block to check for exceptions try { // making thread to sleep for 300 nano-seconds // using sleep() method Thread.sleep(300); } // Catch block to handle InterruptedException catch (InterruptedException ie) { } // Display message when exception occurred System.out.println("forgeeks "); } // Method 2 // Main driver method public static void main(String[] args) { // Creating threads using above class as // it is extending Thread class oneThread c1 = new oneThread(); oneThread c2 = new oneThread(); // Starting threads c1.start(); c2.start(); // Checking whether thread is alive or not // Returning boolean true if alive else false System.out.println(c1.isAlive()); System.out.println(c2.isAlive()); } } Output: geeks true true geeks forgeeks forgeeks S Shivani Ghughtyal Article Tags : Java Java-Multithreading Explore Java BasicsIntroduction to Java3 min readJava Programming Basics9 min readJava Methods6 min readAccess Modifiers in Java4 min readArrays in Java7 min readJava Strings8 min readRegular Expressions in Java3 min readOOP & InterfacesClasses and Objects in Java9 min readAccess Modifiers in Java4 min readJava Constructors10 min readJava OOP(Object Oriented Programming) Concepts10 min readJava Packages7 min readJava Interface7 min readCollectionsCollections in Java12 min readCollections Class in Java13 min readCollection Interface in Java4 min readIterator in Java5 min readJava Comparator Interface6 min readException HandlingJava Exception Handling6 min readJava Try Catch Block4 min readJava final, finally and finalize4 min readChained Exceptions in Java3 min readNull Pointer Exception in Java5 min readException Handling with Method Overriding in Java4 min readJava AdvancedJava Multithreading Tutorial3 min readSynchronization in Java10 min readFile Handling in Java4 min readJava Method References9 min readJava 8 Stream Tutorial7 min readJava Networking6 min readJDBC Tutorial5 min readJava Memory Management4 min readGarbage Collection in Java6 min readMemory Leaks in Java3 min readPractice JavaJava Interview Questions and Answers15+ min readJava Programs - Java Programming Examples7 min readJava Exercises - Basic to Advanced Java Practice Programs with Solutions5 min readJava Quiz1 min readJava Project Ideas For Beginners and Advanced15+ min read My Profile ${profileImgHtml} My Profile Edit Profile My Courses Join Community Transactions Logout Like