Question d’entretien chez Blip (Portugal)

How to make a class immutable

Réponse à la question d'entretien

Utilisateur anonyme

7 nov. 2024

The class must be final to prevent inherantance, every attribute must by final to prevent writing new values on them, remove any setter method that we have and ensure that every get in the class returns a deep copy insteaf of a shallow one