SlideShare a Scribd company logo
Multithreading in Java
training.javatpoint.com
What is Multithreading?
 Multithreading in Java is a process of running multiple threads simultaneously.
 It is a feature of Java that allows two or more parts of a program to be
executed simultaneously.
 Java multithreading is being used in games, animations etc.
training.javatpoint.com
What is a thread?
A thread is a lightweight and smallest unit of processing in Java.
Java provides Thread class to achieve thread programming.
Threads can be created by using two means :
1. Implementing the Runnable Interface
2. Extending the Thread class
training.javatpoint.com
A thread always exists in one of the
following states:
1. New
2. Active
3. Blocked / Waiting
4. Timed Waiting
5. Terminated
training.javatpoint.com
Advantages of Java Multithreading
1. It can perform multiple operations at once, which saves time.
2. Threads are independent, so if an exception occurs in a single thread it does
not affect other threads.
3. Performance has improved.
training.javatpoint.com
Thank you!
training.javatpoint.com

More Related Content

More from ArshikaSingh2

More from ArshikaSingh2 (15)

Features of XML.pdf
Features of XML.pdfFeatures of XML.pdf
Features of XML.pdf
 
Features of Selenium.pdf
Features of  Selenium.pdfFeatures of  Selenium.pdf
Features of Selenium.pdf
 
Standard Libraries of Python.pdf
Standard Libraries of Python.pdfStandard Libraries of Python.pdf
Standard Libraries of Python.pdf
 
Advantages and disadvantages of SQL.pdf
Advantages and disadvantages of SQL.pdfAdvantages and disadvantages of SQL.pdf
Advantages and disadvantages of SQL.pdf
 
Advantages of Microservices.pdf
Advantages of Microservices.pdfAdvantages of Microservices.pdf
Advantages of Microservices.pdf
 
Features of Laravel.pdf
Features of Laravel.pdfFeatures of Laravel.pdf
Features of Laravel.pdf
 
Features of C#.pdf
Features of C#.pdfFeatures of C#.pdf
Features of C#.pdf
 
Advantages of JSON.pdf
Advantages of JSON.pdfAdvantages of JSON.pdf
Advantages of JSON.pdf
 
Lifecycle of a thread in Java.pdf
Lifecycle of a thread in Java.pdfLifecycle of a thread in Java.pdf
Lifecycle of a thread in Java.pdf
 
Features of C++.pdf
Features of C++.pdfFeatures of C++.pdf
Features of C++.pdf
 
Top Features of PHP.pdf
Top Features of PHP.pdfTop Features of PHP.pdf
Top Features of PHP.pdf
 
Features of Android.pdf
Features of Android.pdfFeatures of Android.pdf
Features of Android.pdf
 
Types of Databases.pdf
Types of Databases.pdfTypes of Databases.pdf
Types of Databases.pdf
 
Python Keywords.pdf
Python Keywords.pdfPython Keywords.pdf
Python Keywords.pdf
 
OOPs Concepts of python.pdf
OOPs Concepts of python.pdfOOPs Concepts of python.pdf
OOPs Concepts of python.pdf
 

Multithreading in Java.pptx

  • 2. What is Multithreading?  Multithreading in Java is a process of running multiple threads simultaneously.  It is a feature of Java that allows two or more parts of a program to be executed simultaneously.  Java multithreading is being used in games, animations etc. training.javatpoint.com
  • 3. What is a thread? A thread is a lightweight and smallest unit of processing in Java. Java provides Thread class to achieve thread programming. Threads can be created by using two means : 1. Implementing the Runnable Interface 2. Extending the Thread class training.javatpoint.com
  • 4. A thread always exists in one of the following states: 1. New 2. Active 3. Blocked / Waiting 4. Timed Waiting 5. Terminated training.javatpoint.com
  • 5. Advantages of Java Multithreading 1. It can perform multiple operations at once, which saves time. 2. Threads are independent, so if an exception occurs in a single thread it does not affect other threads. 3. Performance has improved. training.javatpoint.com