Final (Java): Difference between revisions

Content deleted Content added
No edit summary
Cleaned sentence.
Line 27:
= Final variables =
 
A '''final [[variable]]''' is [[Immutable object|immutable]], i. e. it can only be assigned to once. If the variable is a field of a class, it must be assigned to in the constructor of its class. (Note: If the variable is a reference, this means that the variable cannot be re-bound to reference another object. But the object that it references is still mutable, if it was originally mutable.)
 
Unlike the value of a [[constant (computer science)|constant]], the value of a final variable is not necessarily known at compile time.