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

Amity University Noida B.Tech...
Apply
Among top 100 Universities Globally in the Times Higher Education (THE) Interdisciplinary Science Rankings 2026
XIME Bangalore PGDM Admission...
Apply
Accredited by AICTE & NBA | Highest CTC 14.7 LPA | Average CTC 10.5 LPA | Key Recruiters: EY, Deloitte, KPMG, HCL
Amrita University B.Tech 2026
Apply
Recognized as Institute of Eminence by Govt. of India | NAAC ‘A++’ Grade | Upto 75% Scholarships
Amity University, Noida | Law...
Apply
Among top 100 Universities Globally in the Times Higher Education (THE) Interdisciplinary Science Rankings 2026
Great Lakes Institute of Mana...
Apply
Application deadline: 4th Dec | Globally Recognized by AACSB (US) & AMBA (UK) | 17.8 LPA Avg. CTC for PGPM 2025
Manav Rachna University Law A...
Apply
Admissions open for B.A. LL.B. (Hons.), B.B.A. LL.B. (Hons.) and LL.B Program (3 Years) | School of Law, MRU ranked No. 1 in Law Schools of Excelle...
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