Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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. 
 
PREVIOUS NEXT
Tagged: #fields #final #immutable
ADD COMMENT
Topic
Name
9+5 =