当前位置:网站首页>3. What is the difference between final, finally, and finalize?
3. What is the difference between final, finally, and finalize?
2022-08-03 06:22:00 【Shiyu】
One, final immutable
Usually used to modify a class or a method or a variable
1. When modifying a class, it means that this class cannot be inherited.(Avoid overriding methods, change some functions)
2. When modifying a method, it means that this method cannot be overridden.(same as above)
3. When modifying a variable, it means that the reference to this variable cannot be changed.(Ensure that the value of the variable is correct and avoid being modified randomly)
Second, finally the last
It is usually used with try-catch block to ensure that the last one is processed after some business is processed, such as closing the database connection and waiting.Normally it will be implemented.
Note: It may not be executed. For example, an infinite loop while(true) is used in try or the program System.exit(1), System.exit(0) is exited in advance.
System.exit(0): exit normally
System.exit(1): Abnormal exit
Three, finalize completed
A method of java.lang.obejct, which is used to reclaim some specific resources before the object is reclaimed by the garbage processor.
边栏推荐
- 使用JSP实现简单的登录注册功能,并且使用Session跟踪用户登录信息
- How the world's leading medical technology company maximizes design productivity | SOLIDWORKS Product Exploration
- Phase Vocoder的补充完善,Matlab音频变速不变调、变调不变速
- MCU接收串口字符型数据转换成数据型数据
- AI智能剪辑,仅需2秒一键提取精彩片段
- ZEMAX | 如何创建简单的非序列系统
- @JsonProperty和JSONField的区别?
- 【C语言】斐波那契数列
- 2021-04-30
- 嵌入汇编-1 格式讲解
猜你喜欢

ZEMAX | 在设计抬头显示器(HUD)时需要使用哪些工具?

自监督论文阅读笔记 Self-supervised Label Augmentation via Input Transformations

SolidWorks 操作视频 | 流体分析结果演示

MySql的Sql语句的练习(试试你能写出来几道呢)

中空编码器的作用——唯样商城

自监督论文阅读笔记 Ship Detection in Sentinel 2 Multi-Spectral Images with Self-Supervised Learning

【C语言】斐波那契数列

数组与字符串12-数组拆分

电子元器件和电子元件的区别有那些?

自监督论文阅读笔记 Self-Supervised Deep Learning for Vehicle Detection in High-Resolution Satellite Imagery
随机推荐
Dynamic adjustment subject web system?Look at this one is enough
6. What is the difference between Vector, ArrayList and LinkedList?(design, performance, safety)
浮点型数据在内存中存储的表示
VCC(电源)和 GND(地)之间电容的作用
电子元器件和电子元件的区别有那些?
2021-03-22
MATLAB给多组条形图添加误差棒
使用JSP实现简单的登录注册功能,并且使用Session跟踪用户登录信息
数组与字符串12-数组拆分
电子元器件之电子变压器可分为哪几类?
JS--正则表达式
ARMv8 架构----armv8 类别
g++参数说明
二分查找2 - x的平方根
【第四周】MobileNet和HybridSN
ZEMAX | 如何创建复杂的非序列物体
Eight, the difference between the interface of the abstract class
【第二周】卷积神经网络
自监督论文阅读笔记: MoCoV2使用动量对比学习改进基线
【七夕特效】 -- 满屏爱心