class Ticket extends Thread
{
private static int tick = 100; //初始化票数为100张。
public void run()
{
while(true)
{
if(tick>0)
{
System.out.println(Thread.currentThread().getName()+" "+tick--);
}
}
}
}
class TicketDemo
{
public static void main(String[] args)
{
Ticket t1 = new Ticket();
Ticket t2 = new Ticket();
Ticket t3 = new Ticket();
Ticket t4 = new Ticket();