publicvoidfirst(Runnable printFirst)throws InterruptedException { // printFirst.run() outputs "first". Do not change or remove this line. printFirst.run(); latchA.countDown(); }
publicvoidsecond(Runnable printSecond)throws InterruptedException { latchA.await(); // printSecond.run() outputs "second". Do not change or remove this line. printSecond.run(); latchB.countDown(); }
publicvoidthird(Runnable printThird)throws InterruptedException { latchB.await(); // printThird.run() outputs "third". Do not change or remove this line. printThird.run(); }