How do you make a class not inherited in Java?

To prevent inheritance, use the keyword “final” when creating the class . The designers of the String class realized that it was not a candidate for inheritance and have prevented it from being extended.

Sizin İçin Seçtik  How is salary calculated in Java for employees?

Leave a Reply

Your email address will not be published. Required fields are marked *