当前位置:网站首页>抽象类和接口的区别
抽象类和接口的区别
2022-07-06 09:20:00 【快醒醒鸭今天你编程了吗?】
首先咱们来看抽象类,什么是抽象类?
1、抽象类里不一定有抽象方法,抽象类必须要有关键字abstract来修饰
2、如果一个类包含抽象方法,那么这个类一定是抽象类
3、抽象类不能用final修饰代表,因为抽象类是被用于继承的,但是final修饰代表不可修改,不可继承
接口和抽象类的区别?
1、一个子类只能继承一个抽象类,但是可以实现多个接口
2、抽象类有构造方法,接口没有构造方法
3、抽象类可以有普通成员变量,接口中不能有
4、抽象类和接口都可以有静态成员变量,但是抽象类中成员变量可以是任意类型,接口只能是public static final(默认)
5、抽象类中不一定要有抽象方法,但是接口中的方法必须都是抽象的
6、抽象类中可以有静态方法,接口中不能有静态方法
7、抽象类中的方法可以是public、protected,接口中的方法只能是public
边栏推荐
- CorelDRAW plug-in -- GMS plug-in development -- Introduction to VBA -- GMS plug-in installation -- Security -- macro Manager -- CDR plug-in (I)
- TYUT太原理工大学2022数据库考试题型大纲
- Alibaba cloud side: underlying details in concurrent scenarios - pseudo sharing
- 1.C语言矩阵加减法
- 【九阳神功】2016复旦大学应用统计真题+解析
- MPLS experiment
- 4.二分查找
- 2. C language matrix multiplication
- View UI Plus 发布 1.3.1 版本,增强 TypeScript 使用体验
- Differences and application scenarios between MySQL index clock B-tree, b+tree and hash indexes
猜你喜欢

The latest tank battle 2022 - Notes on the whole development -2

1.C语言矩阵加减法

Design a key value cache to save the results of the most recent Web server queries

String class

Smart classroom solution and mobile teaching concept description

1.初识C语言(1)

IPv6 experiment

8.C语言——位操作符与位移操作符

Caching mechanism of leveldb

1. C language matrix addition and subtraction method
随机推荐
Implement queue with stack
View UI Plus 发布 1.3.1 版本,增强 TypeScript 使用体验
(超详细onenet TCP协议接入)arduino+esp8266-01s接入物联网平台,上传实时采集数据/TCP透传(以及lua脚本如何获取和编写)
最新坦克大战2022-全程开发笔记-1
分支语句和循环语句
IPv6 experiment
167. Sum of two numbers II - input ordered array - Double pointers
The overseas sales of Xiaomi mobile phones are nearly 140million, which may explain why Xiaomi ov doesn't need Hongmeng
vector
string
【九阳神功】2020复旦大学应用统计真题+解析
Set container
继承和多态(下)
1.C语言初阶练习题(1)
C language to achieve mine sweeping game (full version)
8.C语言——位操作符与位移操作符
arduino+水位传感器+led显示+蜂鸣器报警
View UI plus released version 1.3.0, adding space and $imagepreview components
Pit avoidance Guide: Thirteen characteristics of garbage NFT project
3.输入和输出函数(printf、scanf、getchar和putchar)