当前位置:网站首页>接口抽象类的比较
接口抽象类的比较
2022-06-22 09:10:00 【C_x_330】
抽象类
特点:
1.抽象类中可以构造方法
2.抽象类中可以存在普通属性,方法,静态属性和方法。
3.抽象类中可以存在抽象方法。
4.如果一个类中有一个抽象方法,那么当前类一定是抽象类;抽象类中不一定有抽象方法。
5.抽象类中的抽象方法,需要有子类实现,如果子类不实现,则子类也需要定义为抽象的。
接口
1.在接口中只有方法的声明,没有方法体。
2.在接口中只有常量,因为定义的变量,在编译的时候都会默认加上
public static final
3.在接口中的方法,永远都被public来修饰。
4.接口中没有构造方法,也不能实例化接口的对象。
5.接口可以实现多继承
6.接口中定义的方法都需要有实现类来实现,如果实现类不能实现接口中的所有方法
7.则实现类定义为抽象类。
边栏推荐
- Flask blog practice - integrated rich text editor quill
- Solidity from introduction to practice (V)
- 两个线程各执行100次i++,得到的可能值
- 国外十款免费开源PHP网店程序介绍
- Manually mining XSS vulnerabilities
- Solidity from introduction to practice (IV)
- Summary of microexpression data set (full)
- STM32 crashes when upgrading bootloader to jump app Online
- VMware installation Kali
- Interview shock 59: can there be multiple auto increment columns in a table?
猜你喜欢

threejs实现简单全景看房demo
![Wireless routing attack and WiFi password cracking practice [penetration technology]](/img/b9/3551630c128e03731a956c6a6502e2.jpg)
Wireless routing attack and WiFi password cracking practice [penetration technology]

电机学感应电动机重点知识总结(现有题目中反映的)

面试突击59:一个表中可以有多个自增列吗?

【node】node+短信api 实现验证码登录

DOM programming

Solidity from introduction to practice (III)

Continuous training on tensorflow breakpoint (principle + code explanation)

ffmpeg之volumedetect

Troubleshooting various errors when Navicat for MySQL connects to MySQL database
随机推荐
Luogu p5406 [thupc2019] find tree
前馈和反向传播
【Tensorboard】所有雷区都踩,一文解决你所有问题
Fanatical NFT, foam or tuyere?
Development error reporting record
【node】理论+实践让你拿下session、cookie
threejs实现简单全景看房demo
Yolov5 export GPU inference model export
Pytorch oserror: DLL load failed: problem solving
VMware installation Kali
面试突击59:一个表中可以有多个自增列吗?
IP address (IPv4)
炒股致富之curl抓股票信息
Sound and shadow 2022 heavy release! Detailed explanation of the new functions of Huisheng Huiying 2022
报告:在技术领域,男性更有可能获得工作面试的机会
Win11 mongodb installation tutorial
800+ PHP grammar and words are proficient only after you have used them
Summary of key knowledge of induction motor in Electrical Engineering (reflected in existing topics)
Quick search system (aso+xls) v1.0
Curl grasping stock information