December 2017

Immutable Objects in Java

  • Satish 

1. Overview In this tutorial, we’ll learn what makes an object immutable, how to achieve immutability in Java, and what advantages come with doing so. 2. What’s an Immutable Object? An immutable object is an¬†object whose internal state remains constant after it has been entirely created. This means that the public API of an immutable object guarantees us that it will behave in the same way during its whole lifetime. If we take a look at the class¬†String, we can… Read More »Immutable Objects in Java