I\'m reading Java The Complete Reference(9th Edition) after year of fooling around with Java. Been happy with the book so far but I now have a really strange problem with sy
When multiple threads are waiting on a lock, there is no guarantee as to which thread the lock will be given once its released. The docs does not specify how this order is handled, but its also not random. I cant say for certain, but it seems the default implementation gives the lock in a LIFO style (Last in first out) and thats why world is outputted first. Give it a try with some more objects.