author & internet detective
posted 10 months ago
Yes, your example shows that == demonstrates there are now two different objects and equals() shows both objects have the same content. What you are doing is making a defensive copy, which you can read about here and here. The second link appears to be an excerpt from Effective Java™ by Joshua Bloch.Carey Brown wrote:. . . behavior of == vs equals(). . . .