Wednesday, September 20, 2006

Final but not Static Variables

Declaring variables as final but not static and not assigning it any initial value allows different constant values for each instance of the class to be assigned in the constructor.

A final variable that refers to an object always refers to the same object. However, values within the object to which it points may change. Similarly, a final variable that refers to an array always refers to the same array, even though elements in that array can change.

No comments: