当前位置:网站首页>Common exceptions
Common exceptions
2022-04-23 03:29:00 【Aiyou coffee】
The concept of abnormality : Exception refers to abnormal things that happen during operation , It will interrupt the running program .
In life , According to the different exception corresponding processing , Without interrupting our lives .
exception handling :Java Programming language uses exception handling mechanism to provide error handling ability for programs
step : The way to deal with the exception in the program in advance , The program runs , Exception found , Handle exceptions , Finished processing , The program continues to run
Java The exception handling of 5 Keywords to achieve :try,catch,finally,throw,throws
After abnormality :1, location ( Find out what's unusual )2, modify
try In the statement block, there are code logic blocks that may have exceptions 【try , catch Capture exception 】
try......catch.......finally [ If the exception is finally, that finally It will also present ] Except in one case ,JVM stop it
finally Processing logic includes those ?
1.I/O The closing operation of flow is generally placed in finally In the block
2. The database connection operation is generally placed in finally In the block
throws: Declaration exception (main If there is no in the method, it will throw Java virtual machine ) There is try,catch Just use throws
throw: Throw an exception 【 You can only throw it once, not many times 】
throwable: For the parent class Up again object
exception: By application Java Throw and handle non critical errors
error: A serious error that cannot be recovered by the program itself 【 Unavoidable 】
checked: Abnormal during inspection
Custom exception :Java Of API Provide rich exception classes in
1. Inherit exception
2. Custom construction method
3. Use when needed throw new Custom exception
版权声明
本文为[Aiyou coffee]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220619008904.html
边栏推荐
猜你喜欢

. net webapi access authorization mechanism and process design (header token + redis)

2022 团体程序设计天梯赛 模拟赛 1-8 均是素数 (20 分)
![Idea view history [file history and project history]](/img/b2/3128105eca7449c55146ce3b9e5c2e.png)
Idea view history [file history and project history]

Is it difficult to choose binary version control tools? After reading this article, you will find the answer

Supersocket is Used in net5 - command

Section 1 array and slicing in Chapter 6
![[vs Code] solve the problem that the jupyter file displays exceptions in vs code](/img/f6/a91d03fd140eb5f7688b72e2e6f2bb.png)
[vs Code] solve the problem that the jupyter file displays exceptions in vs code

7-1 introduction to finance

Log4net is in Net core usage

PYMOL-note
随机推荐
Advanced sorting - fast sorting
Chapter 7 of C language programming (fifth edition of Tan Haoqiang) analysis and answer of modular programming exercises with functions
The principle and solution of not allowing pasting in an English Network
C set
Five tips for cross-border e-commerce in 2022
When migrating tslib_ setup: No such file or directory、ts_ open: No such file or director
MySQL installation pit
Quartz. Www. 18fu Used in net core
C-11 problem h: treasure chest 2
AWS from entry to actual combat: creating accounts
浅学一下I/O流和File类文件操作
2021-08-11
可以接收多種數據類型參數——可變參數
Talent Plan 学习营初体验:交流+坚持 开源协作课程学习的不二路径
String input problem
The content of the website is prohibited from copying, pasting and saving as JS code
Code forces round # 784 (DIV. 4) solution (First AK CF (XD)
Supersocket is Used in net5 - command
Database SQL -- simulate inserting a large amount of data, importing / exporting database scripts, timestamp conversion and database basics
L3-011 直捣黄龙 (30 分)