62,614
社区成员
发帖
与我相关
我的任务
分享
class test extends Thread
{
public test (String str)
{
super(str);
}
public void run()
{
for(int i=0;i<20;i++){
System.out.println(getName());
}
}
}
public class ThreadTest {
public static void main(String []args)
{
test t1=new test("Thread1");
test t2=new test("Thread2");
test t3=new test("Thread3");
t1.setPriority(2);
t2.setPriority(5);
t3.setPriority(8);
t1.start();
t2.start();
t3.start();
}
}