Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is multithreading?

Answer Posted / shankar reddy

A thread executes a series of instructions. Every line of
code that is executed is done so by a thread. Some threads
can run for the entire life of the applet, while others are
alive for only a few milliseconds.

Multithreading is the ability to have various parts of
program perform program steps seemingly at the same time.
Java let programs interleave multiple program steps through
the use of threads. For example,one thread controls an
animation, while another does a computation. In Java,
multithreading is not only powerful, it is also easy to
implement.

You can implement threads within a java program in two
ways – Creating an object that extends Class Thread or
implementing the interface Runnable.

The key difference between the two is that Thread class has
a strart() method which your program simple calls whereas
the Runnable class does not have a start method and you
must create a Thread object and pass your thread to its
constructor method. You never call run() method directly;
the start method calls it for you.

Example:

Class MyProcess extends Thread{
Public void run(){
}
public static void main(String args[]){
MyProcess mp = new MyProcess();
mp.start();
}
}
Class MyProcess implements Runnable {
Public void run(){
}
public static void main(String args[]){
Thread mp = new Thread(new MyProcess());
mp.start();
}
}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How variables are declared?

959


Is it possible to instantiate the abstract class?

940


What is the lifetime and scope of a variable?

987


what happens when a thread cannot acquire a lock on an object? : Java thread

1038


Write a program in java to calculate the difference between the sum of the odd level and even level nodes of a binary tree.

1041


When throw keyword is used?

1050


Explain java heap space and garbage collection?

1053


Explain about public and private access specifiers?

1029


In case of inheritance what is the execution order of constructor and destructor?

1104


Why Do I Get A "permission Denied" Error After Downloading The .jnlp Java Launcher For The Vkvm?

1130


What if the main() method is declared as private? What happens when the static modifier is removed from the signature of the main() method?

1173


What are the skills required for core java?

992


what is the difference between a threads start() and run() methods? : Java thread

1003


Are arrays primitive data types?

1156


What is the r character?

996