DEV Community

Discussion on: Why it is not possible to extend a final class in Java?

Collapse
 
elmuerte profile image
Michiel Hendriks

Applied to a field/variable it means: it‘s a constant (the value can’t be modified.)

To be more correct: the variable assignment cannot be modified. Only in case of primitives and immutable objects the value cannot be modified.

final String[] foo = String[] { "bar" };
foo[0] = "quux"; // this is legal.