Styrow.dev
Question 151 of 247
Java Topic: General medium

How can we make the object immutable?

Question

How can we make the object immutable?

Answer

By making it a final class and making all members as private with those being initialized through constructor.