/*
需求:简单的卖票程序
多个窗口买票
*/
class Ticket extends Thread
{
private static int tick=100;
public void run()
{
while(true)
{
if(tick>0)
{
System.out.println(Thread.currentThread().getName()+"sale:--"+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();*/
t1.start();
t1.start();
t1.start();
t1.start(); /*已经开启的线程。就不需要再开启了*/
}
}