[concurrency-interest] concurrency puzzle
David Holmes
dcholmes at optusnet.com.au
Sun Sep 10 19:16:49 EDT 2006
Jeremy,
Now you've confused me :)
> If, on the other hand, the print() method assigns a value to y before
> the println() statement, thus:
>
> public void print() {
> y = 42;
> System.out.println(y);
> }
>
> then the same program would either print out 10 or 42, but not 0.
Ummm if the assignment occurs in the print method then the subsequent
println must print 42 regardless because the assignment occurred in the same
thread.
Cheers,
David Holmes
More information about the Concurrency-interest
mailing list