Ulrika Tingle wrote:From what I can see the Sun Java documentation for String doesn't offer any answer as to what's the case.
Which is a good point. Assuming that there is only a single Java implementation and making decisions based on the undocumented internals of the code would possibly (even probably) lead to problems later down the track.
Unless the Java language Specification dictates any behaviour, nothing is guaranteed. While it is stated that Strings are immutable, and therefore certain internal properties do not change it is reasonable to expect that there could be coding tricks under the covers designed to reduce their impact on the application, but this does not mean they are implemented consistently across all Java implementations.