CoderSathi
  • Tutorial
    • Java Tutorial
    • Swing Tutorial
    • JDBC Tutorial
    • Java String Tutorial
    • Servlet and JSP Tutorial
  • Mongo DB
  • AWS
  • DevOps
  • Linux
  • Git
Home > Java > Thread Execution in Java

Java Tutorial

  • Introduction
    • What is Java
    • History Of Java
    • Install Java
    • What is JVM
    • JDK vs JRE vs JVM
    • Java Bytecode
    • OOP vs POP
    • Compile and Run Java
  • Tokens, Expressions and Control Structures
    • Primitive data types
    • Integers
    • Floating Points
    • Characters
    • Booleans
    • User Defined Data Type
    • Declarations
    • Constants
    • Identifiers
    • Literals
    • Type Conversion and Casting
    • Variables
    • Default Variable Initialization
    • Command Line Arguments
    • Arrays of Primitive Types
    • Comment Syntax
    • Garbage Collection
    • Expressions
    • Operators
    • Arithmetic Operator
    • Bitwise and Shift Operator
    • Comparison or Relational Operators
    • Logical Operators
    • Assignment Operators
    • Ternary Operator
    • Increment and Decrement Operator
    • Control Statements
  • OOP Concepts
    • Class and Object
    • Create Class Instance
    • Method
    • Abstraction
    • Encapsulation
    • this keyword
    • Constructor
    • Pass by Value
    • Access Modifier/Control
    • Polymorphism
    • Method Overloading vs Method Overriding
    • Recursion
    • Nested and Inner Class
  • Inheritance and Packaging
    • Inheritance
    • extends Keyword
    • super Keyword
    • Object Class
    • Abstract class
    • Final Class
    • Java Package
    • Interface
  • Handling Error/ Exceptions
    • What is Exception
    • Exception Handling Keywords
    • Common Java Errors
    • User Defined Exception
    • Throwing and re-throwing Exception
    • finally Block
  • Strings
    • Java String Tutorial
  • Threads
    • Introduction
    • Create Thread
    • Thread Lifecycle
    • Thread Priority
    • Thread Synchronization
    • Inner Thread Communication
    • Thread Deadlock
  • IO and Streams
    • java.io Package
    • Files and Directories
    • Byte Stream
    • Character Stream
    • Console Input and Output
    • Serializable and Deserializable
  • Core Packages
    • java.lang Package
    • Math
    • Wrapper Classes
    • java.lang.Number
    • Double
    • Float
    • Integers
    • java.lang.Byte
    • java.lang.Short
    • java.lang.Long
    • java.lang.Character
    • java.lang.Boolean
    • java.util package
    • Vector Class
    • Stack Class
    • Dictionary Class
    • Hashtable
    • Enumeration or Enum
    • Generate Random Number
  • Holding Collection of Data
    • Arrays
    • Map
    • List
    • Set
    • Collection Interface
    • Collections Class
    • ArrayList
    • HashSet
    • TreeSet
    • Comparator
  • Java Bean
    • What is Java Bean
    • Advantages and Disadvantages of Java Bean
    • Java Beans API
    • Introspection
    • Java Bean Properties
    • Bound and Constrained Properties
    • BeanInfo Interface
    • Customizers
    • Java Beans Persistence
    • BeanDescriptor
  • Home

Thread Execution in Java

Learn the concepts, implementation details, and practical steps with a clean developer-focused walkthrough.

Yuba Raj Kalathoki
By Yuba Raj Kalathoki
Last updated: July 1, 2026 ยท 2 min read ยท 0 Comments
Share: in X

Thread execution in Java refers to the way that the Java Virtual machine (JVM) executes the thread or a small unit of a program. In Java, threads can be created in a number of ways, including extending the Thread class, implementing the Runnable interface, or using executor services.

start() method in Thread

The start() method is used to begin the execution of a thread. When the start() method is called on a thread, the thread’s run() method is called by the JVM. The run() method is where the code that will be executed by the thread should be placed.

sleep() method in Thread

The sleep() method can be used to pause the execution of a thread for a specified amount of time. This can be useful for implementing delays or pausing the execution of a thread for a certain period of time. The sleep() method can throw an InterruptedException, so it should be used within a try-catch block or the method containing the sleep() call should declare that it throws InterruptedException.

join() method in Thread

The join() method can be used to wait for a thread to complete its execution. When the join() method is called on a thread, the calling thread will block until the thread it is joining completes its execution.

One way to create a new thread in Java is by extending the Thread class and overriding the run() method. And another way to create a thread in Java is by implementing the Runnable interface and providing an implementation of the run() method. I’ve written another post on how to create a thread in Java. You can visit there for more detail on this topic.

The start(), run(), sleep(), and join() methods are all important for controlling the execution of threads in Java. The start() method begins the execution of a thread, the run() method contains the code that will be executed by the thread, the sleep() method can be used to pause the execution of a thread for a specified amount of time, and the join() method can be used to wait for a thread to complete its execution. These methods provide a powerful way to control the concurrent execution of multiple threads in a Java program. These methods also improve the performance and responsiveness of the Java program.

Related Posts:

  • Create Thread in Java
  • Control Statements in Java
  • What is JVM (Java Virtual Machine)? Architecture,…
  • Compile and Run Java Program
  • Unit Testing and Integration Testing
  • Inner Thread Communication in Java
Tags:javalanguage-fundamentalsthread
Was this article helpful?
โ† Previous ArticleStructured Query Language (SQL)
Next Article โ†’JDBC Configuration

Recent Posts

  • How to implement Passwordless Authentication in Spring Boot: A Step-by-Step Guide
  • How to Use AWS CloudFront Signed URLs in Spring Boot?
  • How to Fix SSH Agent Forwarding on macOS: The Ultimate Guide for Developers
  • How to Read AWS Secrets Manager in Spring Boot (Step-by-Step)
  • How to Fix “Public Key Retrieval is not allowed” MySQL JDBC Error
CoderSathi

Your go-to resource for Java, Spring Boot, Microservices, AWS, and modern development tutorials.

Linkedin

Quick Links

  • About
  • Contact

Popular Topics

  • Java
  • Spring Boot
  • AWS
  • DevOps
  • MongoDB
  • Linux
  • Git
  • How to
ยฉ 2026 CoderSathi. All rights reserved. Privacy Policy ยท Sitemap