next up previous
Next: 1.11.3 Casts and Static Up: 1.11 Loose Ends Previous: 1.11.1 Local variables

  
1.11.2 Finality

A Java class definition, method definition, field definition, method parameter, or local variable may be preceded by the keyword final. This modifier has a slightly different meaning in each of these four contexts:

1.
a final class cannot be extended;
2.
a final method cannot be overridden;
3.
a final field cannot be modified once it is initialized; and
4.
a final parameter cannot be modified.
As long as Java programs are written in a functional style, every field and every parameter can be marked final without adversely affecting program compilation or execution. Henceforth, we recommend this practice.



Corky Cartwright
2001-08-02