Multi thread by implementing Runnable interface

package threaddemo;
class Thread11 implements Runnable
{
	String name="default name";
	public Thread11(){}
	public Thread11(String s){name=s;}
	public void run()
	{
		// Thread.currentThread().setName(name);
		System.out.println(Thread.currentThread().getName());
	}
}
public class App2 {
	public static void main(String[] args) 
	{
Thread11 t1=new Thread11();
Thread th1=new Thread(t1);
th1.start();
Thread11 t2=new Thread11("my name");
Thread th2=new Thread(t2,"your name");
th2.start();
	}
}

Download

Thread Source Code

Thread by extending Thread class
Thread by implementing Runnable interface
Multithread by implementing Runnable interface
Thread Intercommunication
Thread Join Example
Thread Join Example
Main Thread information
Multithreaded Example
Thread Priority
Thread Priority
Thread yield example


Write your Comment

Name :
Email Id : [ We will not publish your email id ]
Your Comment : [ Maximum 200 chars ]
Enter Security code