Here System is a class and out is the static object variable of this class having type of PrintStream.
I mean System.out is static lock.So there is only one lock for both the object t1 and t2.
But when you use 'this',it means lock of current object.t1 and t2 both will have there own lock for 'this'.
That is why in case 1 i.e. System.out,output is all one's than all two's but in case 2 i.e. 'this' lock output is unpredictable.
Now, if I keep lock on 'this' only and start both threads with 't1' as runnable object, I will get nice output of either all One's first or all Two's first.
I am confused with this statement.Please explain this.