Final Classes Cannot Be Superclasses

A final class that’s declared final cannot be a superclass (i.e., a class cannot extend a final class). All methods in a final class are implicitly final. Class String is an example of a final class. If you were allowed to create a subclass of String, objects of that subclass could be used wherever Strings are expected. Since class String cannot be extended, programs that use Strings can rely on the functionality of String objects as specified in the Java API. Making the class final also prevents programmers from creating subclasses that might bypass security restrictions. For more insights on the use of keyword final, visit

docs.oracle.com/javase/tutorial/java/IandI/final.html

and

www.ibm.com/developerworks/java/library/j-jtp1029.html

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset