public class Main { public static void main(String[] args) { Monitor m = new Monitor(); Thread thread1 = new Thread(new MyTask(m)); Thread thread2 = new Thread(new MyTask(m)); thread1.start(); thread2.start(); try { thread1.join(); thread2.join(); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Program ferdig. Tallet ble: "); m.printTall(); } }