Dear friends, Can anyone explain to me why the following program, doesnot show any output. Thnx in advance.
SCJP2 2001 84%<br />SCJD2 2003 100%
posted 15 years ago
This may be possible. Since the doIT() is not synchronized both the thread can access the method concurrently. When the first one finishes the 1st synchronized block and goes for the statemnt j1++, the second one can enter into 1st synchronized block and so on, we can never predict the locks. Since the variables are volatile concurrent changes will effect both the threads and hence you may not have the System.out.println statements get executed. Thanks. khudi