一.Thread实现 public class ThreadDemo4 { publicstaticvoid main(String[] args) { new ThreadTest4().start(); new ThreadTest4().start(); new ThreadTest4().start(); } } class ThreadTest4 extends Thread { privateinttickets = 100; publicvoid run() { booleanlo…
/** * Created by chengtao on 17/12/3. * 多个线程 如何共享数据? * 常见实例:多个窗口同时售卖火车票 */public class Thread0701_MultiThreadShareData { public static void main(String[] args) { SaleTicket data1 = new SaleTicket(); new Thread(data1).start(); new Thread(data1).start(…
Arrays Why arrays are special There are three issues that distinguish arrays from other types of containers: efficiency, type, and the ability to hold primitives. The cost of this speed is that the size of an array object is fixed and cannot be chang…