Classes that are tagged as final can’t be extended. There are
many examples of this technique in the core Java APIs, such as
java.lang.String. Tagging the String class as final prevents
developers from creating their own implementation of the
length method.
Furthermore, if a class is final, all the methods of the class
are also final.
example usage: String class
No comments:
Post a Comment