Content deleted Content added
m →Final methods: Link stated more precisely. Small corrections done. |
m →Final variables: Link stated more precisely. Small corrections done. |
||
Line 27:
= Final variables =
A '''final [[variable]]''' is [[Immutable object|immutable]], i. e.
Unlike the value of a [[constant (computer science)|constant]], the value of a final variable is not necessarily known at compile time.
Line 51:
}
</source>
Immutability of variables has great advantages, especially in optimization. For instance, <code>Sphere</code> will probably have a function returning its volume; knowing that its radius is constant allows us to [[memoize]] the computed volume. If we have relatively few
[[Category:Java programming language]]
|