Program to Create Threads In Java.

class A extends Thread
{

public void run()
{

System.out.println("Thread A has started");
for (int i=0;i<=5;i++)
{

System.out.println("From thread A:i =" +i);
}
System.out.println("Exit from A");
}
}
class B extends Thread
{

public void run()
{

System.out.println("Thread B has started");
for (int j=0;j<=5;j++)
{

System.out.println("From thread B:j =" +j);
if(j==3)
stop();
}
System.out.println("Exit from B");
}
}
class C extends Thread
{

public void run()
{

System.out.println("Thread C has started");
for (int k=0;k<=5;k++)
{

System.out.println("From thread C:k =" +k);
if(k==1)
try{
sleep(100);
}catch(Exception e)
{


}
}
System.out.println("Exit from C");
}
}
class ThreadMethods
{

public static void main(String args[])
{

A ta = new A();
B tb = new B();
C tc = new C();
tc.setPriority(Thread.MAX_PRIORITY);
ta.setPriority(Thread.MIN_PRIORITY);
System.out.println("Start thread A");
ta.start();
System.out.println("Start thread B");
tb.start();
System.out.println("Start thread C");
tc.start();
System.out.println("End of main Thread");
}
}

We Are Founder..