In Java, is new always new?

java

Solution

The `new` operator allocates new heap space and calls the constructor. You will always get a new object that way (unless, as others pointed out, an Exception is thrown in the constructor).

The thing is a little different with static methods that return a reference, such as `Integer.valueOf()` which re-uses objects from an internal pool if possible.

Problem

Is there any way in Java that a statement like ``` Thing thing = new Thing(); ``` could not result in a new object being created (i.e. any way that `thing` could end up pointing to an already-existing object)?

Original source