62,620
社区成员
发帖
与我相关
我的任务
分享public class Starter extends Thread
{
private int x = 2;
public static void main(String[] args) throws Exception
{
Starter a= new Starter();
a.makeItSo();
}
public Starter()
{
x = 5;
start();
}
public void makeItSo() throws Exception
{
System.out.println(Thread.currentThread().getName()+"------------->");
join();/////////////等待该线程终止。
x = x - 1;
System.out.println(x);
}
public void run()
{
System.out.println(Thread.currentThread().getName()+"------------->");
x *= 2;
}
}