当前位置:网站首页>The difference between abstract classes and interfaces
The difference between abstract classes and interfaces
2022-07-06 13:39:00 【Wake up duck, did you program today?】
First, let's look at abstract classes , What is an abstract class ?
1、 Abstract classes don't necessarily have abstract methods , Abstract classes must have keywords abstract To modify
2、 If a class contains abstract methods , So this class must be an abstract class
3、 Abstract classes cannot be used final Embellishment stands for , Because abstract classes are used for inheritance , however final Modified representative cannot be modified , Non inheritable
The difference between interface and abstract class ?
1、 A subclass can only inherit one abstract class , But you can implement multiple interfaces
2、 Abstract classes have construction methods , Interface has no constructor
3、 Abstract classes can have common member variables , There cannot be
4、 Abstract classes and interfaces can have static member variables , But member variables in abstract classes can be of any type , The interface can only be public static final( Default )
5、 There doesn't have to be an abstract method in an abstract class , But the methods in the interface must be abstract
6、 Abstract classes can have static methods , There cannot be static methods in an interface
7、 The methods in an abstract class can be public、protected, Methods in an interface can only be public
边栏推荐
- 4.分支语句和循环语句
- (原创)制作一个采用 LCD1602 显示的电子钟,在 LCD 上显示当前的时间。显示格式为“时时:分分:秒秒”。设有 4 个功能键k1~k4,功能如下:(1)k1——进入时间修改。
- [面試時]——我如何講清楚TCP實現可靠傳輸的機制
- Wei Pai: the product is applauded, but why is the sales volume still frustrated
- 六种集合的遍历方式总结(List Set Map Queue Deque Stack)
- [the Nine Yang Manual] 2018 Fudan University Applied Statistics real problem + analysis
- Cloud native trend in 2022
- 3.猜数字游戏
- Mortal immortal cultivation pointer-1
- [the Nine Yang Manual] 2019 Fudan University Applied Statistics real problem + analysis
猜你喜欢
【手撕代码】单例模式及生产者/消费者模式
2.初识C语言(2)
[面試時]——我如何講清楚TCP實現可靠傳輸的機制
仿牛客技术博客项目常见问题及解答(一)
9.指针(上)
MySQL lock summary (comprehensive and concise + graphic explanation)
[au cours de l'entrevue] - Comment expliquer le mécanisme de transmission fiable de TCP
仿牛客技术博客项目常见问题及解答(二)
The overseas sales of Xiaomi mobile phones are nearly 140million, which may explain why Xiaomi ov doesn't need Hongmeng
3. Number guessing game
随机推荐
Network layer 7 protocol
更改VS主题及设置背景图片
Mortal immortal cultivation pointer-1
六种集合的遍历方式总结(List Set Map Queue Deque Stack)
FAQs and answers to the imitation Niuke technology blog project (III)
Mortal immortal cultivation pointer-2
fianl、finally、finalize三者的区别
Change vs theme and set background picture
Redis实现分布式锁原理详解
Share a website to improve your Aesthetics
This time, thoroughly understand the MySQL index
Caching mechanism of leveldb
C语言入门指南
[中国近代史] 第九章测验
1.初识C语言(1)
关于双亲委派机制和类加载的过程
Questions and answers of "basic experiment" in the first semester of the 22nd academic year of Xi'an University of Electronic Science and technology
View UI plus released version 1.3.0, adding space and $imagepreview components
4. Binary search
[中国近代史] 第六章测验