DEVFYI - Developer Resource - FYI

Why is multiple inheritance not possible in Java?

Java Interview Questions and Answers (part 1)


(Continued from previous question...)

140. Why is multiple inheritance not possible in Java?

It depends on how you understand "inheritance". Java can only "extends" one super class, but can "implements" many interfaces; that doesn't mean the multiple inheritance is not possible. You may use interfaces to make inheritance work for you. Or you may need to work around. For example, if you cannot get a feature from a class because your class has a super class already, you may get that class's feature by declaring it as a member field or getting an instance of that class. So the answer is that multiple inheritance in Java is possible.

(Continued on next question...)

Other Interview Questions