Multiple choice technology programming languages

If multiple inheritance is achieved through java, which is the only way to achieve it?

  1. Abstract Class

  2. Interface

  3. Final Method

  4. none of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Java doesn't support multiple inheritance of classes to avoid the diamond problem and complexity. However, a class can implement multiple interfaces, which is the only way to achieve multiple inheritance in Java. Abstract classes follow single inheritance rules, and final methods prevent overriding entirely.

AI explanation

Java classes can only extend one superclass, so true multiple inheritance of type is achieved by implementing multiple interfaces, since a class can implement as many interfaces as needed. Abstract classes are still single-inheritance (a class can extend only one), and "final method" has nothing to do with inheritance structure at all.