Java - order of execution after wait
问题 all. I have a question for Java wait-notify mechanism. The answer is is there a guaranty that the threads will be executed in this order - from last to the first etc. the result always will be 100, 99, ... , 1 ? This is the snippet of code: public class Main { static int counter = 0; static Object o = new Object(); public static void main(String[] args){ for(int i = 0; i < 100; ++i){ new Thread(() -> { synchronized (o) { try { int c = ++counter; o.wait(); System.out.println("" + c); Thread