How can a final class be a super class if it cannot be inherited according to the definition? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

How can a final class be a super class if it cannot be inherited according to the definition?

I just got this question in a quiz. 'Can a final class be a super class? ' my answer was false which was given wrong. Can anyone explain please?

14th May 2017, 3:02 PM
Prathamesh Jadhav
Prathamesh Jadhav - avatar
2 Respuestas
+ 2
I believe that final classes (or subcomponents there of) are an indication that you can't override the existing features. So a class which inherits from a final class can expand the functionality, but not alter the base class definitions. Take this with a grain of salt, however, I've had a ton of keywords poured into my head these past few weeks.
15th May 2017, 3:29 AM
Jim
Jim - avatar
+ 1
IMO that quiz was wrong. You cannot extend from a final class. You can only wrap it.
14th May 2017, 3:31 PM
Tamás Barta
Tamás Barta - avatar