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.
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Interfaces in Java
- Interfaces in Java
- Callback using Interfaces in Java
- Functional Interfaces In Java
- Private Methods in Java 9 Interfaces
- Access specifiers for classes or interfaces in Java
- Inheritance in Java
- Java and Multiple Inheritance
- Java | Inheritance | Question 1
- Java | Inheritance | Question 9
- Delegation vs Inheritance in Java
- Java | Inheritance | Question 5
- Java | Inheritance | Question 4
- Java | Inheritance | Question 3
- Java | Inheritance | Question 2
- Inheritance and constructors in Java
- Using final with Inheritance in Java
- Comparison of Inheritance in C++ and Java
- Java | Inheritance | Question 7
- Java | Inheritance | Question 8
Improved By : DeepsD