synchronized方法
在看多线程这块,突然有个想法,把synchronized关键字直接加到run方法上,会有什么效果。以卖车票为例,结果就出问题了。MyRunnable m = new MyRunnable(); Thread t1 = new Thread(m,"1"); Thread t2 = new Thread(m,"2"); Thread t3 = new Thread(m,"3");