Tagged in

Core Java

Javarevisited
Javarevisited
A humble place to learn Java and Programming better.
More information
Followers
21K
Elsewhere
More, on Medium

Immutable class in java

We can create immutable classes by following these guidelines:

  1. Declare the class as final, so it cannot be subclassed.
  2. Make all fields private and final, so they cannot be modified after initialization.