import java.util.concurrent.CountDownLatch; public class HorseRace { public static void main(String[] args) { CountDownLatch startSkudd = new CountDownLatch(1); CountDownLatch endOfRace = new CountDownLatch(3); RaceHorse h1 = new RaceHorse("Razzmatazz", startSkudd, endOfRace); RaceHorse h3 = new RaceHorse("Smirnoff ice", startSkudd, endOfRace); RaceHorse h2 = new RaceHorse("Young money", startSkudd, endOfRace); RaceHorse[] horseArr = {h2,h3,h1}; try { for(Thread horse : horseArr) { horse.start(); } for(int i = 3; i > 0; i--){ System.out.println("Starter l?p om " + i); } startSkudd.countDown(); endOfRace.await(); System.out.println("????????Alle hester er i m?l!!!????????"); } catch(InterruptedException e){ Thread.currentThread().interrupt(); } } }