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?