Sobes.tech
Senior
42

osztály Feladat { privát statikus int számláló = 0; nyilvános statikus void main(String[] args) throws Exception { var thread1 = new Thread(() -> növel()); var thread2 = new Thread(() -> növel()); thread1.start(); thread2.start(); thread1.join(); thread2.join(); System.out.println(számláló); } privát static void növel() { for (int i = 0; i < 5000; i++) { számláló++; } } }

Cégeket kérdeztek
сербская компания