Question d’entretien chez SynergisticIT

make immutable class

Réponse à la question d'entretien

Utilisateur anonyme

16 juin 2017

To create immutable class in java, you have to do following steps. 1. Declare the class as final so it can't be extended. 2. Make all fields private so that direct access is not allowed. 3. Make all mutable fields final so that it's value can be assigned only once.

3