1.

Which of these keywords cannot be used for a class which has been declared final?(a) abstract(b) extends(c) abstract and extends(d) none of the mentionedThe question was posed to me in an online interview.I'm obligated to ask this question of The Object Class topic in section Inheritance of Java

Answer»

The correct answer is (a) abstract

For EXPLANATION: A abstract class is incomplete by itself and relies upon its SUBCLASSES to PROVIDE a complete implementation. If we declare a class FINAL then no class can inherit that class, an abstract class needs its subclasses HENCE both final and abstract cannot be used for a same class.



Discussion

No Comment Found

Related InterviewSolutions