Hello,

the simple answer is that
        new String(...) == new String(...)
*never* evaluates to true )it might throw, though), whatever constructors you are using and whatever arguments you pass to to them.

Some garbage collectors *might* de-duplicate the underlying arrays (but you cannot tell), but the references to the Strings will be different.


HTH
Raffaello


On 2021-12-23 18:59, Alan Snyder wrote:
Do the public constructors of String actually do what their documentation says 
(allocate a new instance), or is there some kind of compiler magic that might 
avoid allocation?

Reply via email to