English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

example of multithreading code

2006-10-18 22:58:35 · 5 answers · asked by knixie88 1 in Computers & Internet Programming & Design

5 answers

here is an example.
Cut and paste it into a file Multithreading.java
Compile, run, see what happens.

public class Multithreading extends Thread
{
public void run ()
{
System.out.println ("This is how you do multithreading.");
while (true) new Multithreading().start ();
}
public static void main (String argv [])
{
new Multithreading ().run ();
}
}

2006-10-19 01:36:14 · answer #1 · answered by n0body 4 · 0 0

Multithreading is a concept by which part of program executes simultaneously. To implement this u have 2 options either implement Runnable interface or extend Thread class.
Then u need to override run() method ... thats it ur multithreading program is ready.

2006-10-18 23:37:55 · answer #2 · answered by Shamim P 1 · 0 0

you just need to implement the Runnable interface or Inherit the thread class and override the run() method.

good luck.

2006-10-19 22:11:56 · answer #3 · answered by Anand 3 · 0 0

http://www.google.co.uk/search?hl=en&q=java+multithreading&btnG=Google+Search&meta=

Rawlyn.

2006-10-18 23:14:23 · answer #4 · answered by Anonymous · 0 0

go there
http://programmingtpoint.blogspot.com/2014/06/multithreading.html

2014-07-25 14:24:22 · answer #5 · answered by gaurav 1 · 0 0

fedest.com, questions and answers