package Thread11;
public class MountTest {
public static void main(String[] args) {
// TODO 自动生成的方法存根 Mount cave = new Mount(); new Thread(cave,"李三1").start(); new Thread(cave,"李三2").start(); new Thread(cave,"李三3").start(); new Thread(cave,"李三4").start(); new Thread(cave,"李三5").start(); new Thread(cave,"李三6").start(); new Thread(cave,"李三7").start(); new Thread(cave,"李三8").start(); new Thread(cave,"李三9").start(); new Thread(cave,"李三10").start(); }}class Mount implements Runnable{ private Object lock=new Object(); public void run(){ synchronized(lock){ System.out.println(Thread.currentThread().getName()+"---走出山洞"); try{ Thread.sleep(2000); }catch(InterruptedException e){ e.printStackTrace(); } }
}
}