|
|
|
|
|
by flakes
983 days ago
|
|
Final only protects the variable from being assigned a new reference (similar to a const pointer). It doesn’t protect any of the underlying data held by the object from being changed, unless the entire hierarchy has every field declared final as well. I still use final heavily in all of my Java code, but it doesnt convey the full intent I would like it to. |
|
The consequence is that you may define two classes, one non-mutable and one mutable like String/StringBuilder.