当前位置:网站首页>Finally detailed explanation
Finally detailed explanation
2022-07-02 17:53:00 【Change with affection】
public class test {
public static void main(String[] args) {
System.out.println(tryTest(8));
}
public static int tryTest(int i) {
int result = 0;
Integer obj = i;
try {
System.out.println(" perform try block ");
return result;
//return obj;
} catch (Exception e) {
//return -1;
e.printStackTrace();
} finally {
// No matter whether there is any abnormality or not ||try and catch There is return,finally All the code in the block will execute
System.out.println("final Yes ");
//finally Is in return After statement execution , Return to the previous execution ( The calculated value is not returned , Instead, save the value you want to return , No matter finally
// What about the code in , The value returned will not change , It's still a previously saved value ), So the return value of the function is at finally It has been determined before implementation .
System.out.println(" Reference type variable obj: " + obj + "; Basic data type variable result: " + result);
result = i;//finally The basic data type variable in does not change the returned content
obj = null;//finally The reference to type variables in does not change the returned content
System.out.println(" Reference type variable obj: " + obj + "; Basic data type variable result: " + result);
//finally If it contains return, Then the program will return here , instead of try or catch Medium return return , The return value is not try or catch The return value saved in .
return 999;
}
}

边栏推荐
- [how is the network connected] Chapter 4 explores access networks and network operators
- [nonlinear control theory]7_ High gain and High Frequency
- 【Golang | gRPC】使用gRPC实现简单远程调用
- PMS150C应广单片机开发案例
- Experience Alibaba cloud character recognition OCR
- Development of original Yingguang MCU chip pms152 sop8 encapsulated MCU
- Modbus protocol communication exception
- Virtual lab basic experiment tutorial -7 Polarization (2)
- Keras深度学习实战——基于VGG19模型实现性别分类
- 最长无重复子数组
猜你喜欢
随机推荐
Yingguang single chip microcomputer (MCU popular science)
【网络是怎样连接的】第五章 探索服务器
This "architect growth note" made 300 people successfully change jobs and enter the big factory, with an annual salary of 50W
Map集合详细讲解
Taiwan Feiling fm8pb513b MCU provides MCU program development product design
外包干了五年,废了...
松翰SN8P2511 SOP8单片机 可代烧录 提供单片机方案开发 单片机解密
【曆史上的今天】7 月 2 日:BitTorrent 問世;商業系統 Linspire 被收購;索尼部署 PlayStation Now
List summation [dummy+ tail interpolation + function processing list reference common pit]
Huimang micro IO MCU ft60f011a-rb
RK1126平台项目总结
uva1169
【历史上的今天】7 月 2 日:BitTorrent 问世;商业系统 Linspire 被收购;索尼部署 PlayStation Now
Songhan sn8p2511 sop8 single chip microcomputer can be used for burning, providing single chip microcomputer scheme development and single chip microcomputer decryption
应广单片机开发调试应注意的问题
每日一题——“水仙花数”
原装应广单片机 MCU芯片PMS152 SOP8封装 单片机开发
Ssm+ wechat applet to realize property management system
阿里云子账户 - 权限策略 - 授权给某个账户某个 OSS Bucket 的完全控制权限
Daily question - xiaolele changes the number








