Blog
Thread in Java – TCCI
- November 30, 2020
- Posted by: Riddhi Dhandha
- Category: Java course at TCCI
Thread is the most important part for concurrent execution.
Thread is the light wait process that means one process can be divided in to small small threads which will execute concurrently for fast execution of tasks.
All Java programs have at least one thread, known as the main thread, which is created by the JVM at the program’s start, when the main() method is invoked with the main thread. In Java, creating a thread is accomplished by implementing an interface and extending a class. Every Java thread is created and controlled by the java.lang.Thread class.
A Thread class extends Object class and implements Runnable interface. The one advantage of using Runnable interface over Thread class, is that the class which implements Runnable interface can extend one class or implement multiple interfaces which is not possible by extending thread class.
Example
- classMulti extends Thread{
- publicvoid run(){
- out.println(“thread is running…”);
- }
- publicstatic void main(String args[]){
- Multi t1=newMulti();
- start();
- }
- }
TCCI Computer Coaching Institute teach Thread in Java in Bopal and Satellite in Ahmedabad.
You can Join Programming Language Course at TCCI. Online Coaching is also available.
For more information about Computer Courses at TCCI.
Visit us @ http://tccicomputercoaching.com/
Call us @ 98256 18292
Leave a Reply Cancel reply
[vc_row full_width=”” parallax=”” parallax_image=””][vc_column width=”1/1″][vc_widget_sidebar sidebar_id=”default”][/vc_column][/vc_row]