It is because both threads (main and t1) are synchronized on same reference. Thread t1 will not be in "running" state unless main thread comes out of synchronized block. And by that time it has modified the contents of string array.
If you remove any of synchronized block, 900 milliseconds are sufficient (although it is not a guarantee) to t1 to run. So you may not always get "XYZ" in that case.
Hope this helps. Nandu
He's my best friend. Not yours. Mine. You can have this tiny ad:
a bit of art, as a gift, the permaculture playing cards