Which of the following is/are correct with reference to abstract class and interface?
Which of the following is/are correct with reference to abstract class and interface?
(1) A class can inherit only one Abstract class but may inherit several interfaces
(2) An Abstract class can provide complete and default code but an interface has no code
Codes :
Show answerHide answer
Correct answer: (C) Both (1) and (2) are true
Explanation
An interface is an empty shell: there are only the signatures of the methods, which do not have a body, so statement (2) is true. A class can extend only a single class, whereas it can implement multiple interfaces, so statement (1) is true.