O'Reilly logo
  • You Wang thinks this is interesting:

Occasionally, you want to prevent someone from forming a subclass from one of your classes. Classes that cannot be extended are called final classes, and you use the final modifier in the definition of the class to indicate this. For example, suppose we want to prevent others from subclassing the Executive class. Simply declare the class using the final modifier, as follows:


Cover of Core Java® Volume I—Fundamentals, Tenth Edition


use "final" to disable inheritance