Ask Question
28 March, 20:58

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.

+5
Answers (1)
  1. 28 March, 22:41
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers