这个小程序为什么一运行电脑就死机啊
public class test1
{
public static void main(String[] args)
{
xc xc1=new xc();
new Thread(xc1).start();
//如果再添加一个new Thread(xc1).start()线程就会死机,不知道为啥[/color]
}
}
class xc implements Runnable
{
private int total=20;
public void run()
{
while(true)
{
if(total>0)
System.out.println(Thread.currentThread().getName()+"tickets is"+total--);
}
}
}