Inheritance and abstract class of interface in java basic tutorial

In implementing the interface, we use the interface syntax to separate the interface from the class definition and form a main body. Interface provides an interface specification for a class.

In inheritance, in order to improve the reusability of programs, we introduce the inheritance mechanism. Inheritance was class based. The interface interface can also be inherited to expand the original interface.

Interface inheritance

Interface inheritance is very similar to class inheritance, which is to add a new interface method prototype based on the inherited interface. For example, we use cup as the original interface:

(see implementing interfaces for how to use interfaces)

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>