//开启四个窗口售票 public class RunnableTiccket { public static void main(String[] args) { Tickets2 ticket = new Tickets2(); new Thread(ticket).start(); new Thread(ticket).start(); new Thread(ticket).start(); new Thread(ticket).start(); } } class Tickets2 implements Runnable{ int total = 100; public void run(){ while (total!=0) { System.out.println(Thread.currentThread().getName()+",出售票:"+(total--)); } } }
本文出自 “要么拼命,要么滚回去!” 博客,请务必保留此出处http://jiangzuun2014.blog.51cto.com/8732469/1440589