|
|
|
|
final classes: Preventing InheritanceSometimes, you will wish to prevent someone from deriving a class from one of your classes. A class that cannot be used as a superclass is called a final class. To specify that a class is final, you use the final keyword:
final methodsIt is also possible to declare a specific method in a class final, meaning that no subclass can override that method. All methods in a final class are automatically final. Reasons for making classes or methods final
final fields (data)Remember that |
|
This page was last modified on 02 October, 2007 |