- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How multiple inheritance is implemented using interfaces in Java?
Java does not support multiple inheritance. This means that a class cannot extend more than one class. Therefore, following is illegal −
Example
public class extends Animal, Mammal{}
However, a class can implement one or more interfaces, which has helped Java get rid of the impossibility of multiple inheritance.
The extends keyword is used once, and the parent interfaces are declared in a comma-separated list.
For example, if the Hockey interface extended both Sports and Event, it would be declared as −
Example
public interface Hockey extends Sports, Event
- Related Articles
- Interfaces and inheritance in Java Programming
- How to inherit multiple interfaces in Java?
- Interfaces and Inheritance in C#
- Java and multiple inheritance
- Why multiple inheritance is not supported in Java
- How abstraction is achieved using interfaces in Java?
- Multiple inheritance by Interface in Java
- Why multiple inheritance is not supported by Java?
- Can an interface in Java extend multiple interfaces?
- Java Program to Implement Multiple Inheritance
- What are the interfaces implemented by Array class in C#?
- What is diamond problem in case of multiple inheritance in java?
- Can an interface extend multiple interfaces in Java?\n
- Multiple Inheritance in C++
- Multiple inheritance in JavaScript

Advertisements