class A extends Thread
{
public void run()
{
for(int i=1;i<=5;i++)
{
System.out.println("threadA : "+i);
}
}
}
class B extends Thread
{
public void run()
{
for(int i=1;i<=5;i++)
{
System.out.println("threadB : "+i);
}
}
}
class ThreadMax
{
public static void main(String args[])
{
A a =new A();
B b =new B();
b.setPriority(Thread.MAX_PRIORITY);
a.run();
b.run();
}
}
{
public void run()
{
for(int i=1;i<=5;i++)
{
System.out.println("threadA : "+i);
}
}
}
class B extends Thread
{
public void run()
{
for(int i=1;i<=5;i++)
{
System.out.println("threadB : "+i);
}
}
}
class ThreadMax
{
public static void main(String args[])
{
A a =new A();
B b =new B();
b.setPriority(Thread.MAX_PRIORITY);
a.run();
b.run();
}
}
0 comments:
Post a Comment