
Class A implememts Runnable
{
Public Void Run()
for(int i=1'i<=5;i=i+2)
{
System.out.println("Inside
Thread A:i="+i);
}
System.out.println("Exit From
A.");
}
class B implements Runnable
{
Public void run()
{
for(int j=2;j,=6;j=j+2)
}
system.out.println("Inside
Thread B:j="+j);
}
system.out.println("Exit From
B.");
}
}
class c implements Runnable
{
Public void run()
}
for(int k=3;k<6;k=k+3)
{
System.out.println("inside
thread c: k="k);
System.out.println("Exit From
C."k);
}
}
Class multhread
{
Public Static Void main(String
args[])
{
A objA=new A();
Thread Th1=new Thread(objA);
B objB=new B();
Thread Th2=new Thread(objB);
C objB=new C();
Thread Th3=new Thread(objC);
system.out.println("Staring
Thread A:");
Th1.start();
system.out.println("Staring
Thread B:");)
Th2.start();
system.out.println("Staring
Thread C:");)
Th3.start();
system.out.println("Exit From
Main Thread.");)
}
}
No comments:
Post a Comment