We have 2 Threads in Java:
Thread 1:
…
public void run()
{
while (Share.COUNTER<8)
Share.COUNTER++;
}
…
Thread 2:
…
public void run()
{
while (Share.COUNTER>-7)
Share.COUNTER--;
}
…
The question is: Which thread is going to be terminated by the while loop at first? The second question is: Is there a guarantee that the threads will terminate the run methods? Could you help me answering this questions since threads in Java is new to me.