- 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
Interfaces and inheritance in Java Programming
Inheritance can be defined as the process where one class acquires the properties (methods and fields) of another. With the use of inheritance the information is made manageable in a hierarchical order. The class which inherits the properties of other is known as subclass (derived class, child class) and the class whose properties are inherited is known as superclass (base class, parent class).
Types of Inheritance
There are various types of inheritance as demonstrated below.

A very important fact to remember is that 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. And an interface can extends one or more interfaces. 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 C#
- Functional Interfaces in Java Programming
- How multiple inheritance is implemented using interfaces in Java?
- Object Serialization with Inheritance in Java Programming
- Inheritance in Dart Programming
- Hierarchical Inheritance in Dart Programming
- MultiLevel Inheritance in Dart Programming
- Differentiate between Application Programming Interfaces (APIs) and system calls.
- Interfaces in Java
- Java and multiple inheritance
- Difference Between Packages and Interfaces in Java
- Inheritance in Java
- Difference between inheritance and composition in Java
- Multilevel inheritance in Java
- Evolution of interfaces in Java
