Sunday, January 27, 2008

What is a Thread in Java?

A thread executes a series of instructions. Every line of code that is processed is done so by a thread. Few threads can run for the complete life of the applet, while others are alive for only a few milliseconds. A thread can also create a new thread or kills an existing one if when a new thread is created by the user. The Threads run in methods or constructors. The methods and constructors reside in the computer's memory themselves are lifeless in thread case. The threads go into the methods and continue to follow their instructions.

Multithreading in Java
Java provides built-in support for multithreaded programming. A multithreaded program will have 2 or more parts that can run concurrently. Each part of such a program in java is called a thread, and each thread defines a separate path of execution. It is a specialized form of multitasking. There are two distinct types of multitasking namely Process-based and Thread-based.


Post a Comment

Subscribe to Post Comments [Atom]

<< Home