Originally posted by Kitty Dayal:
Thanks for reply. But my question was related to duplication of objects in the pool. Since there is already a "abc" present, Will it not use it? Or Why does it not use it here?
The objects in the pool are used only in constant expressions or by calling the intern() method. Since x.concat("c") is calculated at runtime, objects in the pool are not used. Let me give you a few more examples: