Answers for "why fields should be final in immutable class?"

0

why fields should be final in immutable class?

You can only make mutable fields as final, for immutable the reason is that tomorrow someone will come and setter into that class unknowingly so adding final will prevent that.
Posted by: Guest on February-17-2022

Code answers related to "why fields should be final in immutable class?"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language