Home
Multi threading in Java:
Multithreading in Java is a process where multiple threads run concurrently within a single program.
It helps improve performance and efficient CPU utilization.
A **thread** is the smallest unit of execution in a program.
### Advantages of Multithreading
* Faster execution
* Better CPU utilization
* Concurrent task processing
* Improved application responsiveness
* Useful in games, web servers, banking apps, etc.
---
# Life Cycle of a Thread
1. **New** – Thread object created
2. **Runnable** – Ready to run
3. **Running** – Executing
4. **Blocked/Waiting** – Waiting for resources
5. **Terminated** – Execution completed
---
Add: Promote healthy body function and support extended energy levels
Creating Threads in Java:
There are mainly two ways:
## 1. By Extending `Thread` Class
```java
class MyThread extends Thread {
public void run() {System.out.println("Thread is running");}
public static void main(String[] args) {
MyThread t1 = new MyThread();
t1.start();
}
}
```
### Output
```text
Thread is running
```
---
Add: Key to Reversing type 2 diabetes
Wishing you all the best.
From: www.seeyourneeds.in