At the end of the child thread end again, this time using the join () method,
System. Out.println (Thread. CurrentThread (). The getName () + "Thread running start!" );
Thread6 thread1=new Thread6 ();
Thread1. Elegantly-named setName (" thread "B");
Thread1. The join ();
System. The out. Println (" then can thread1 execution after execution of the main thread ");
CodePudding user response:
The join () is the main function of synchronization, it can make the thread between parallel execution into serial execution