三个线程顺序执行
作者:互联网
1 static void test9() throws InterruptedException{ 2 Thread thread1=new Thread(()->{ 3 try { 4 System.out.println("111"); 5 Thread.sleep(1000); 6 }catch (Exception ex){} 7 8 }); 9 Thread thread2=new Thread(()->{ 10 try { 11 System.out.println("222"); 12 Thread.sleep(1000); 13 }catch (Exception ex){} 14 15 }); 16 Thread thread3=new Thread(()->{ 17 try { 18 System.out.println("333"); 19 Thread.sleep(1000); 20 }catch (Exception ex){} 21 22 }); 23 thread1.start(); 24 thread1.join(); 25 thread2.start(); 26 thread2.join(); 27 thread3.start(); 28 thread3.join(); 29 System.out.println("main thread end"); 30 }
标签:顺序,Thread,System,ex,线程,thread2,println,执行,out 来源: https://www.cnblogs.com/tiancai/p/16070669.html