June 2017
Beginner
1296 pages
69h 23m
English
final Methods and ClassesWe saw in Sections 6.3 and 6.10 that variables can be declared final to indicate that they cannot be modified after they’re initialized—such variables represent constant values. You also declare method parameters final to prevent them from being modified in the method’s body. It’s also possible to declare methods and classes with the final modifier.
A final method in a superclass cannot be overridden in a subclass—this guarantees that the final method implementation will be used by all direct and indirect subclasses in the hierarchy. Methods that are declared private are implicitly final, because it’s not possible to override them in a subclass. Methods that are declared static ...