请阅读下列给出的程序,并根据程序的功能改正程序中的错误
改写以下多线程程序,使之能够实现在四个售票处,发售某日某次列车的共100张票。
public class ThreadDemo{
public void main(String [] args) {
new ThreadTest().start(); new ThreadTest().start();
new ThreadTest().start(); new ThreadTest().start();
}
}
class ThreadTest extends Thread {
private int tickets=100;
public void run() {
while(1 ) {
if(tickets>0)
System.out.println(Thread.currentThread().getName()
+" is saling ticket " + tickets--);
}
}
}