//Program to demonstrate the use of multithreading :
import java.io.*;
class NewThread implements Runnable
{
Thread t;
NewTHread( )
{
t-new Thread(this, “Demo thread”);
System.out.printin(“child thread”+t);
t.start( );
}
public void run( )
{
try {
for(int i=5;i>0; i–)
{
System.out.printin(“child Thread:”+t);
Thread.sleep(500);
}
}
catch(InterruptedException e)
{
System.out.printin(“child Interrupted”);
}
System.out.printil(“existing child thread”);
}
}
class threaddemo
{
public static void main(String args[])
class ThreadMethod1
{
public static void main(String args[])
Thread t=Thread.currentThread( );
System.out.printIn(“current thread:+t);
System.out.printIn(“name of the current thread:”+t.getName( ));
System.out.printIn(“prioity:”+t.priority( ));
t.setName(“mythread”);
System.out.printIn(“after name change;”+t);
t.setpriority(2);
System.out.printIn(“after priority change:”+t);
System.out.printIn(‘number of active threads:”+t.activeCount( ));
}
}
Home      |      About Us      |     Portfolio      |      Services      |      Courses      |     Career      |      Cost      |      Contact Us
Services
  SEO   
  Link Building
  Data Entry
  Web Design and development
  Web Application development
 

Graphic and multimedia

  E-Commerce Solutions
  Software development
  Web Marketing & Promoting
  Internet Marketing
  IT Outsourcing
  Multimedia/CD Presentation
  Synopsis Ideas
  Project Ideas
  Placement Papers
  Live Project Training
  Programming & Projects
  Faq
  Training @balujalabs
 
 
Method
 

Program To Demonstrate The Use Of Multithreading

 

 

 

 

 

 

 

 

 

                                                                                                                                          

1

Following Example Shows How To Start Stop, Suspend, and Resume Threads. It uses the Runnable interface. Threads Like this are useful for Things like Controlling Animation Sequences Or Repeatedly Playing Audio Sample .This Example Uses a Thread that Countess that and prints a String every second. The thread starts when the applet is initialized. It continues to run until the user leaves the page, if the user returns to the page (and all is well) the thread continues from where it left off. This allows applets to retain their states while the user is away.

2

Program To Demonstrate The Use Of Multithreading

3 Program To Demonstrate Thread Operator
4 Program To Demonstrate Priority Thread
5

Program To Demonstrate Multithreading