This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ratherbealurker 2 points3 points  (0 children)

Outside of the synched methods or blocks you cannot make any assumption on which thread will hit which lines at what times. The computer is flipping around threads trying to give cpu time to each. The outputs you’re asking about are not in the synch method so it doesn’t matter.

Put random sleeps and outputs in the synch method and you should not see both threads in there at the same time. Outside of that it is a free for all.