1.

What Is The Final Class Modifier?

Answer»

As you have learned, Java LETS one CLASS extend ANOTHER. When you design a class, there may be times when you don't want another programmer to extend the class. In such cases, by INCLUDING the final keyword within a class definition, you prevent the class from being subclassed. The following statement ILLUSTRATES the use of the final keyword within a class definition:

public final class TheBuckStopsHere { }

As you have learned, Java lets one class extend another. When you design a class, there may be times when you don't want another programmer to extend the class. In such cases, by including the final keyword within a class definition, you prevent the class from being subclassed. The following statement illustrates the use of the final keyword within a class definition:



Discussion

No Comment Found