Frage im Vorstellungsgespräch bei SynergisticIT

make immutable class

Antwort im Vorstellungsgespräch

Anonym

16. Juni 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