60 Views

avoid inheritance in java language


Grag 12th Sep, 2021
Answer (1)
Vishesh Singh 12th Sep, 2021

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

Related Questions

VIT Bhopal University | M.Tec...
Apply
M.Tech admissions open @ VIT Bhopal University | Highest CTC 52 LPA | Apply now
Amity University | M.Tech Adm...
Apply
Ranked amongst top 3% universities globally (QS Rankings).
Amity University Noida MBA Ad...
Apply
Amongst top 3% universities globally (QS Rankings)
Graphic Era (Deemed to be Uni...
Apply
NAAC A+ Grade | Among top 100 universities of India (NIRF 2024) | 40 crore+ scholarships distributed
XAT- Xavier Aptitude Test 2026
Apply
75+ years of legacy | #1 Entrance Exam | Score accepted by 250+ BSchools | Apply now
Amity University Noida B.Tech...
Apply
Among Top 30 National Universities for Engineering (NIRF 2024) | 30+ Specializations | AI Powered Learning & State-of-the-Art Facilities
View All Application Forms

Download the Careers360 App on your Android phone

Regular exam updates, QnA, Predictors, College Applications & E-books now on your Mobile

150M+ Students
30,000+ Colleges
500+ Exams
1500+ E-books