Welcome: inside the method m1 Welcome: inside the method m2
An interface can also extend multiple interfaces.
Rohit JIIT CSE
Why Multiple Inheritance is not supported through a class in Java, but it can be possible through the interface?
Multiple Inheritance is not supported by class because of ambiguity. In case of interface, there is no ambiguity because implementation to the method(s) is provided by the implementing class up to Java 7. From Java 8, interfaces also have implementations of methods. So if a class implementing two or more interfaces having the same method signature with implementation, it is mandated to implement the method in class also. Refer Java and Multiple Inheritance for details.
This article is contributed by Nitsdheerendra. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
- Access specifiers for classes or interfaces in Java
- Interfaces in Java
- Functional Interfaces In Java
- Interfaces in Java
- Callback using Interfaces in Java
- Private Methods in Java 9 Interfaces
- Why Java Interfaces Cannot Have Constructor But Abstract Classes Can Have?
- Access specifier of methods in interfaces
- Two interfaces with same methods having same signature but different return types
- Inheritance and constructors in Java
- Comparison of Inheritance in C++ and Java
- Java and Multiple Inheritance
- Difference between Inheritance and Composition in Java
- Difference between Inheritance and Interface in Java
- Inheritance in Java
- Using final with Inheritance in Java
- Object Serialization with Inheritance in Java
- Java | Inheritance | Question 1
- Java | Inheritance | Question 2
- Java | Inheritance | Question 3
Improved By : DeepsD