import java.util.concurrent.CountDownLatch; public class Taco { public static void main(String[] args) { CountDownLatch latch = new CountDownLatch(2); new Thread(new ChopVegetablesTask(latch)).start(); new Thread(new CookMeatTask(latch)).start(); Thread tortillaThread = new Thread(new HeatTortillasTask(latch)); tortillaThread.start(); try { tortillaThread.join(); // Vi trenger kun ? vente p? tortillatr?den siden den er ferdig hviss de to andre tr?dene er det } catch (InterruptedException e) { System.err.println("Noe gikk galt! " + e); } System.out.println("Taco is done!"); } }