This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Then what happen actually is a String Object is created on Constant String Pool or Object is created on heap as any other object and Constant String Pool contain only reference of that object crrated.
Objects are always created on the heap. The reference to the literal Objects are stored in the String pool. And the reference variable str also contains the same value as the reference value in the String pool.