Previous | Next | Trail Map | Writing Java Programs | Java Objects


Declaring a Final Method

You can use the final keyword in a method declaration to indicate to the compiler that the method cannot be overridden by subclasses.

You will want to make some methods final to prevent subclasses from overriding that method particularly if the method has an implementation that cannot and should not be changed and is critical to the consistent state of the object. For example,


Previous | Next | Trail Map | Writing Java Programs | Table of Contents