当前位置:网站首页>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;
}
}

边栏推荐
- PMS150C应广单片机开发案例
- 【网络是怎样连接的】第五章 探索服务器
- VirtualLab基础实验教程-7.偏振(2)
- Songhan sn8p2511 sop8 single chip microcomputer can be used for burning, providing single chip microcomputer scheme development and single chip microcomputer decryption
- Solution pour arrêter automatiquement les paquets Jar en cours d'exécution en éteignant le serveur de connexion xshell
- Linux中,mysql设置job任务自动启动
- 应广PMC131 SOP16 16pin八位单片机
- What should we pay attention to in the development process of Yingguang single chip microcomputer?
- Virtual lab basic experiment tutorial -7 Polarization (1)
- Does pytorch support 32 bits?
猜你喜欢

Platform management background and business menu resource management: business permissions and menu resource management design

【目标跟踪】|SiamFC

MB10M-ASEMI整流桥MB10M
![[非线性控制理论]8_三种鲁棒控制器的比较](/img/a8/03ed363659a0a067c2f1934457c106.png)
[非线性控制理论]8_三种鲁棒控制器的比较

Laravel文档阅读笔记-Custom Authentication Login And Registration Using Laravel 8

ORA-19838 -- 恢复控制文件到备库
![[how is the network connected] Chapter 6 requests arrive at the server and respond to the client (end)](/img/ef/1ac272dbd0e5c4d08a8f01f61d334d.png)
[how is the network connected] Chapter 6 requests arrive at the server and respond to the client (end)

【网络是怎样连接的】第六章 请求到达服务器以及响应给客户端(完结)

开发一个禁止删除namespace的控制器

515. 在每个树行中找最大值
随机推荐
Are you holding back on the publicity of the salary system for it posts such as testing, development, operation and maintenance?
售价仅40元,树莓派Pico开发板加入WiFi模块,刚上市就脱销
Wechat applet - arrows floating up and down
Daily question - xiaolele changes the number
Pms132b single chip microcomputer TWS digital tube Bluetooth charging chamber program development
透过华为军团看科技之变(六):智慧公路
Laravel文档阅读笔记-Custom Authentication Login And Registration Using Laravel 8
【网络是怎样连接的】第六章 请求到达服务器以及响应给客户端(完结)
RK1126平台项目总结
MB10M-ASEMI整流桥MB10M
[how to connect the network] Chapter 5 explore the server
Easyswoole3.2 restart failed
应广单片机开发调试应注意的问题
Daily question - "number of daffodils"
wps插入图片后使图片完整显示
【Zuul】com.netflix.zuul.exception.ZuulException: Hystrix Readed time out
Pfc232-sop8/14/16 should be wide-ranging and can be tape programmed with burning program
Modbus协议通信异常
finally详解
使用Zadig从0到1搭建持续交付平台