This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
The code is taken directly from Dr. K's book. Mutex class creates two threads: Pusher and Popper.
MY QUESTION: The output of the code is: Exit from main(). Pushed: true Popped: null What I can't understand is why is popped null. First, I thought maybe because the JVM did a context switch in the middle of incrementing toOfStack, but then I put in System.out statements and there was no context switch during ++topOfStack.
Here is the code:
Joined: Jun 10, 2004
the smiley face shouldn't be there: the for loop is an infinite loop.