Classes, Part 2: CS 310 Lecture notes

Object-Oriented Programming with Java Lecture Notes

5 February 2009 • Classes, Part 2


The one exception is constant (final) instance variables, which are read-only and so can’t be interfered with from outside the containing class. Note, however, that a constant instance variable is interference-free only when it has a non-reference type, or it has a reference type to a immutable class (such as String). Even in those cases, some guidelines argue against making constant instance variables non-private.


This page last modified on 24 January 2006.