当前位置:网站首页>Abstract classes and interfaces
Abstract classes and interfaces
2022-07-26 07:54:00 【Why can't I eat mango】
1. Definition : Use abstract Keyword decorated class , It's called an abstract class , Used in abstract classes abstract Keyword modification , Methods without method bodies are called abstract methods , Abstract methods must be defined in abstract classes . Interfaces are more abstract methods than abstract methods , use interface Methods of keyword modification , The interface is implemented with implements keyword .
2. difference
The abstract method of the interface can not write the modifier and abstract keyword .
A class can only inherit one abstract class , But multiple interfaces are allowed to be implemented , Its subclasses are called implementation classes .
Ordinary methods can be defined in abstract classes , Construction method , But ordinary methods and construction methods cannot be defined in the interface , from JDK 1.8 Start , There is a use default Methods of keyword modification , There are methods , Equivalent to ordinary methods of abstract classes , It's called the default method .
Members can be defined in abstract classes " Variable ", It can be modified when creating objects , The member variable defined in the interface is a constant , Assignment is required when defining , It is not allowed to be modified , Constants in abstract classes must use final Keyword modification .
边栏推荐
- 2022.7.22DAY612
- Matlab drawing black spots on two / three-dimensional drawings
- Deep learning model deployment
- Sort: merge sort and quick sort
- Sort sort IP addresses
- Anaconda 中安装 百度飞浆Paddle 深度学习框架 教程
- Machine learning related competition website
- From boosting to lamdamart
- MMOE多目标建模
- Unity metaverse (II), mixamo & animator hybrid tree and animation fusion
猜你喜欢

Unity metaverse (II), mixamo & animator hybrid tree and animation fusion

ARIMA model for time series analysis and prediction

利用js实现统计字符串数组中各字符串出现的次数,并将其格式化为对象数组。

Jmeter性能测试之命令行执行和生成测试报告

以太网交换安全

Now developers are beginning to do testing. Will there be no software testers in the future?

Use js to count the number of occurrences of each string in the string array, and format it into an object array.

Matlab drawing black spots on two / three-dimensional drawings

Regression analysis code implementation

Kdd2022 | uncover the mystery of Kwai short video recommendation re ranking, and recommend the new SOTA
随机推荐
table 固定特定行
Unity metaverse (II), mixamo & animator hybrid tree and animation fusion
音视频学习(十)——ps流
From boosting to lamdamart
Hcip--- MPLS detailed explanation and BGP route filtering
Polymorphism, final and interface
Practice of online question feedback module (XIV): realize online question answering function
Network ()
Basic knowledge of convolutional neural network
OVS underlying implementation principle
Summary of distributed related interview questions
LeetCode剑指offer专项(一)整数
MySQL implementation plan
Parameterization of JMeter performance test using CSV file
Table fix specific rows
Hystrix配置简单说明
ARIMA model for time series analysis and prediction
Jmeter性能测试之使用存储响应内容到文件监听器
Open source management system based on ThinkPHP
Selenium: detailed explanation of browser crawler use (I)