Hello,
You cannot restrict inheritance in Java. But 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.
Hope this helps
Thank You
Regular exam updates, QnA, Predictors, College Applications & E-books now on your Mobile