Ask Question
30 October, 07:41

Which of the following is not possible? A class that implements two interfaces. A class that inherits from two classes. A class that inherits from one class, and implements an interface. All of these are possible.

+4
Answers (1)
  1. 30 October, 10:49
    0
    "A class that inherits from two classes"

    Explanation:

    If we're talking about Java, you can't extend from two classes. The reason for this is Java doesn't allow multiple inheritance.

    The reason for this is to avoid the ambiguity caused by it. One of the cases where multiple inheritance can cause ambiguity is the diamond problem.

    Diamond problem can occur if two classes (say B and C) inherit from one class (say A). And another class (say D) inherits from both B & C.

    If B and C class override the same method from A class. And D class calls that method, which one will be called, class B's or C's?
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Which of the following is not possible? A class that implements two interfaces. A class that inherits from two classes. A class that ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers