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

边栏推荐
- VirtualLab基础实验教程-7.偏振(1)
- The price is only 40 yuan. Pico development board of raspberry pie is added with WiFi module, and it is out of stock as soon as it comes into the market
- Longest non repeating subarray
- em120.gige.h
- 【GAMES101】作业4 Bézier 曲线
- Pms132b single chip microcomputer TWS digital tube Bluetooth charging chamber program development
- USB interface powered Bluetooth color light strip controller
- [target tracking] |siamfc
- Map集合详细讲解
- Linux中,mysql设置job任务自动启动
猜你喜欢

Platform management background and merchant menu resource management: merchant role management design

RK1126平台项目总结

Solution to the problem that the easycvr kernel of intelligent video analysis platform cannot be started as a service

深入理解ThreadLocal

Larvel document reading notes custom authentication login and registration using larvel 8

PFC232-SOP8/14/16应广一级可带烧录程序编带

【网络是怎么连接的】第四章 探索接入网和网络运营商

透过华为军团看科技之变(六):智慧公路

freemarker+poi实现动态生成excel文件及解析excel文件

维护万星开源向量数据库是什么体验
随机推荐
[target tracking] |siamfc
把xshell连接服务器关掉,运行的jar包就自动停止的解决方案
Two pieces of nature a day! Duan Fengfeng, an alumnus of the University of science and technology of China, was the third Chinese winner of the belby medal
应广单片机003烧录器自定义封装使用技巧
Modbus协议通信异常
每日一题——小乐乐改数字
Rk1126 platform project summary
【目标跟踪】|SiamFC
PMS132B单片机TWS数码管蓝牙充电仓方案开发
体验一下阿里云文字识别OCR
[comment le réseau se connecte] chapitre 6: demande d'accès au serveur et réponse au client (terminé)
Ssm+ wechat applet to realize property management system
HDU - 1114 Piggy Bank (full backpack)
ASEMI整流桥UMB10F参数,UMB10F规格,UMB10F封装
一日2篇Nature!中科大校友段镶锋团队纳米材料新成果,曾是贝尔比奖章第三位华人得主...
uva1169
POJ - 1458 common subsequence (longest common subsequence)
Longest non repeating subarray
Are you holding back on the publicity of the salary system for it posts such as testing, development, operation and maintenance?
515. 在每个树行中找最大值