Thu. Jul 31st, 2025

Immutable Objects Using Record in Java


It is often useful to have objects that, once created, don’t change their content. To see a complete description on how to build such class, you can read my previous article “Immutable Objects in Java”.

Let’s imagine we want to build a PersonClass with two fields: firstName and lastName. To create immutable instances, this class must:

By uttu

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *