Interfaces and Inheritance in Java
Interfaces and Inheritance in Java
A class can extends another class and/ can implement one and more than one interface.
@Override
public void geekInstitute()
{
System.out.println("JIIT");
}
Output:
Why multiple inheritance is not supported through class in Java, but it can be possible through interface ?.
Multiple inheritance is not supported by class because of ambiguity. In case of interface there is no ambiguity because implementation to
method(s) is provided by the implementing class. 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 protected]. 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.