当前位置:网站首页>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 .
边栏推荐
- Ethernet switching security
- Utils connection pool
- Rack server expansion memory
- 《门锁》引爆独居安全热议 全新海报画面令人窒息
- Shardingsphere data slicing
- 元宇宙基础设施:WEB 3.0 chain33 优势分析
- Meta universe infrastructure: analysis of the advantages of Web 3.0 chain33
- Regular expression rules and common regular expressions
- Learning Efficient Convolutional Networks Through Network Slimming
- PostgreSQL UUID fuzzy search UUID string type conversion SQL error [42883] explicit type casts
猜你喜欢

Installation of Baidu flying paste deep learning framework tutorial in Anaconda

【uniapp】多种支付方式封装

From boosting to lamdamart

PXE efficient batch network installation

系统架构&微服务

JWT快速入门

DCN (deep cross network) Trilogy

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

Unity Metaverse(二)、Mixamo & Animator 混合树与动画融合

Learning Efficient Convolutional Networks Through Network Slimming
随机推荐
Crawler - > tpimgspider
Why is Google's internal tools not suitable for you?
Shardingjdbc pit record
【uniapp】多种支付方式封装
Selenium: detailed explanation of browser crawler use (I)
2019 ZTE touyue · model compression scheme
C语言关键字extern
PyTorch
QT listview add controls and pictures
ARIMA model for time series analysis and prediction
动态性能视图概述
Jmeter性能测试之将每次接口请求的结果保存到文件中
[uniapp] encapsulation of multiple payment methods
Practice of online question feedback module (XIV): realize online question answering function
Use js to count the number of occurrences of each string in the string array, and format it into an object array.
Abnormal (2)
ShardingSphere数据分片
Next item recommendations in short sessions
Use of JMeter performance test to store response content to file listener
How to determine the authenticity of the website you visit -- certificate system