DZone Java Zone
Follow
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: