On 02/06/2011 05:43 AM, Jacob Carlborg wrote:
On 2011-02-04 21:44, Jeff Nowakowski wrote:

Java's substring() does not copy the text, at least in the official JDK
implementation. Unfortunately, it doesn't specify this behavior as part
of the String API.

But, I assume, it will allocate a new instance of String even though the
content point to the same data?

Yes, but small objects in Java are very fast to allocate and garbage collect.

Reply via email to