You could use Executors.newSingleThreadExecutor(), but strictly speaking this launches only one Thread
, so may not be expected solution.
The simpliest solution using just Thread
class:
Thread1.start();
Thread1.join();
Thread2.start();
Thread2.join();
Thread3.start();
Thread3.join();
(I omitted exception handling for clarity, Thread.join()
can throw InterruptedException
)