Senior
54
classe Compito { privato static int contatore = 0; pubblico static void main(String[] args) throws Exception { var thread1 = new Thread(() -> aumentare()); var thread2 = new Thread(() -> aumentare()); thread1.start(); thread2.start(); thread1.join(); thread2.join(); System.out.println(contatore); } privato static void aumentare() { per (int i = 0; i < 5000; i++) { contatore++; } } }
Le aziende dove è stato chiesto
сербская компания