final Class

A final class is a class that can’t be used as a base class. To declare a class as final, just add the final keyword to the class declaration:

public final class BaseBall

{

// members for the BaseBall class go here

}

Then no one can use the BaseBall class as the base class for another class.

When you declare a class final, all its methods are considered final as well. The final keyword isn’t required on any method of a final class.

Get Java For Dummies Quick Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.