Correct me if I am wrong. When you say new String("x") then two objects are created. One of them is placed on the heap and the other in the String pool (If not present). So when you iterate through the loop, new object is created everytime for new String("..") and another String object for new String("..") + i. So how does the result end up with 11?