class MyThread /*extends Thread */implements Runnable
{
private int ticket=100;
public void run()
{
for(int i=0;i<200;i++)
{
if(ticket>0)
//try{Thread.sleep(1000);}catch(Exception e){}
System.out.println(Thread.currentThread().getName()+"正在卖票"+ticket--);
}
}
}
class Sale
{
public static void main(String[] args)
{
/*Thread mt1 = new MyThread();
Thread mt2 = new MyThread();
mt1.start();
mt2.start();*/
MyThread mt = new MyThread();
new Thread(mt,"窗口1").start();
new Thread(mt,"窗口2").start();
new Thread(mt,"窗口3").start();
}
}