Home  >  Article  >  Java  >  What is single inheritance in java?

What is single inheritance in java?

藏色散人
藏色散人Original
2019-05-22 14:39:4913266browse

In Java, single inheritance means that a subclass can have at most one parent class. JAVA does not support multiple inheritance. Single inheritance makes the inheritance relationship of JAVA very simple. A class can only have one parent class, which is easy to manage the program. At the same time, a class can implement multiple interfaces, thereby overcoming the shortcomings of single inheritance.

What is single inheritance in java?

Java is a simple, object-oriented, distributed, interpreted, robust, secure, architecture-neutral, and portable , high-performance, multi-threaded, dynamic language.

Inheritance

Inheritance is divided into single inheritance and multiple inheritance.

Single inheritance means that a subclass can have at most one parent class.

Multiple inheritance means that a subclass can have more than two parent classes.

Because multiple inheritance brings ambiguity, classes in the Java language only support single inheritance, while interfaces support multiple inheritance.

The function of multiple inheritance in Java is implemented indirectly through interfaces

JAVA does not support multiple inheritance. Single inheritance makes the inheritance relationship of JAVA very simple. A class only Having one parent class makes it easy to manage the program, and one class can implement multiple interfaces at the same time, thereby overcoming the shortcomings of single inheritance.

The above is the detailed content of What is single inheritance in java?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn