Java - InterfacesWhy does Java use interfaces instead of allowing multiple inheritance of classes?ABecause interfaces can be instantiated directlyBBecause interfaces can store state while classes cannotCTo force all classes to be abstractDTo avoid ambiguity and complexity from multiple class inheritanceCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand multiple inheritance issuesMultiple class inheritance can cause ambiguity and complexity in method resolution.Step 2: Role of interfacesInterfaces provide multiple inheritance of method signatures without state, avoiding these problems.Final Answer:To avoid ambiguity and complexity from multiple class inheritance -> Option DQuick Check:Interfaces prevent multiple inheritance issues [OK]Quick Trick: Interfaces avoid multiple inheritance problems [OK]Common Mistakes:Thinking interfaces store stateBelieving interfaces force abstract classesAssuming interfaces can be instantiated
Master "Interfaces" in Java9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Java Quizzes Abstraction - Why abstraction is required - Quiz 9hard Abstraction - Abstract methods - Quiz 14medium Classes and Objects - Class definition - Quiz 12easy Constructors - Default constructor - Quiz 1easy Custom Exceptions - Creating custom exception class - Quiz 14medium Encapsulation - Data hiding - Quiz 3easy Inheritance - Why inheritance is used - Quiz 15hard Inheritance - Why inheritance is used - Quiz 12easy Object-Oriented Programming Concepts - Classes and objects - Quiz 2easy Object-Oriented Programming Concepts - Real-world modeling - Quiz 5medium