孙鑫java视频——多线程总结
采集日期:2008-5-3作者:hepeng19861212(注:本数据由系统自动采集,内容与BHCODE无关)
//模拟火车票售票系统
class TicketsThread{
public static void main(String args[])
{
SellThread mythread=new SellThread();
new Thread(mythread).start();
new Thread(mythread).start();
new Thread(mythread).start();
new Thread(mythread).start();
//这4个线程同时进行售票
}
}
class SellThread implements Runnable{
int tickets=100;//一共要卖100张票
public void run()
{
while(true){