June 2004
Intermediate to advanced
848 pages
21h 28m
English
final MeansThis section looks at final, which makes something constant. Why was the word “const” or “constant” not chosen? Because “final” can also be applied to methods, as well as data, and the term “final” makes better sense for both.
A class or a class member (that is, a data field or a method) can be declared final, meaning that once it is given a value it won't change. We will look at what it means for a class or a method not to change in Chapter 8. A couple of final data declarations are:
final static int myChecksum = calculateIt();final Timestamp noon = new Timestamp(12, 00, 00);final int universalAnswer = 42;
When a reference variable is declared final, it means that you cannot change that variable to point ...
Read now
Unlock full access