public class Main {
public static void main(String[] args) {
MutliThread m = new MutliThread();
Thread t1 = new Thread(m, "Window 1");
Thread t2 = new Thread(m, "Window 2");
t1.start();
t2.start();
}
}
class MutliThread implements Runnable {
private int ticket = 100;// 每个线程都拥有100张票
public void run()
{
while(ticket>0)
System.out.println(ticket-- + " is saled by " + Thread.currentThread().getName());;
}
}
10-29
06-25
06-12
08-11