Introduction to the differences between Java abstract classes and interfaces

The difference between abstract classes and interfaces

abstract class

A class containing abstract methods is an abstract class. The declared statement: abstract class must be public protected

Interface

For behavior abstraction, declaration statement: interface abstract method modifier: public abstract member variable modifier: public static final

Grammatical level

Design level

Abstract class is the abstraction of things and classes; An interface is an abstraction of behavior and describes a behavior specification

Abstract class is an abstract description of the whole class, including attributes and behaviors; Interfaces can only abstract the behavior of classes

Attach a picture:

Thank you for reading, hope to help you, thank you for your support to this site!

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
分享
二维码
< <上一篇
下一篇>>