Apologies if this question has been beaten to submission :-). I saw few online articles suggesting that the subString (method of String Class) returns a String backed by the same char array that the original String is built on ?.
Honestly, I was looking at the internal implementation of String (jdk7) and seems like this is not the case ?.
It used to. I think it just got changed in Java 7.
It probably stemmed from the early days of Java when object creation and GC was a lot more expensive than it is now. Probably most substring() calls lead to strings that are not a tiny portion of a huge string and/or are relatively short-lived, so the cases where the "leak" would matter were pretty rare, while the memory management overhead savings were comparatively large, thus making it worth it.
Now, presumably, since the overhead associated with object creation and GC is much diminished, the designers probably figured it's no longer a worthwhile savings.