public class SaleTicket {
public static void main(String[] args) {
//创建一个Runnable实例
Runnable runnable=new MyRunnable();
//开启3个线程卖票
new Thread(runnable,"1窗口").start();
new Thread(runnable,"2窗口").start();
new Thread(runnable,"3窗口").start();
}
}
/**
* 实现Runnable接口,覆写run方法。
* @author Cam
*
*/
class MyRunnable implements Runnable
{
int sum=50;