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.
You can't, not as the code is written. If "number" were an instance variable instead of a local variable, then it would be accessible:
There's potentially another problem: the variable "number" is being accessed by two different threads, and that can lead to problems with the two threads not seeing the same value for the variable. I believe that in this case, it's OK because of the call to join() and the synchronization that it involves. Anyone disagree?