当前位置:网站首页>Difference and understanding between detected and non detected anomalies
Difference and understanding between detected and non detected anomalies
2022-07-06 13:39:00 【Wake up duck, did you program today?】
1、 B. abnormal
The so-called checked exception actually indicates that it is at the time of compilation , Exceptions to force check , This exception needs to be displayed through try/catch To capture or through throws Throw it out, otherwise the program cannot be compiled .
2、 Undetected abnormal
The so-called unchecked exception means that the compiler does not need to force to check the exception , This exception does not need to be displayed to catch or throw .
stay java All exceptions inside need to be inherited java.lang.Throwable This class is shown below :
Throwable There are two direct subclasses :
- Error: It refers to errors at the bottom of the program or at the hardware level , Like the usual OOM abnormal ( Memory overflow exception ) So this exception has nothing to do with the program itself, so it doesn't need to check whether it belongs to Undetected abnormal .
- Exception: It indicates some exceptions in the program , It may be caused by lax procedures, such as NullPointerException( Null pointer exception ) etc. ,Exception Two exception types are derived
- RuntimeException: The runtime exception belongs to the non inspected exception
- other Exception
Summary :
So in addition to Error and RuntimeException as well as RuntimeException Outside the derived class of , Other exceptions belong to the detected exceptions, such as :IOException and SQLException, In fact, the reason is Java I think the main reason for designing some exceptions for mandatory inspection is :
Consider the correctness of the program 、 stability 、 reliability , As mentioned above, database exceptions are unexpected exceptions of the program, but once there is a problem, it will cause an occupation of resources and cause some problems in the program , So we need to catch these problems. Once there is a problem, we can deal with it in time , If we operate the database try/catch And then finally close xxx.close Close the connection , So generally speaking, the detected exception is an exception that cannot be judged in the program. Let's use try/catch Capture .
边栏推荐
- 1.C语言矩阵加减法
- [the Nine Yang Manual] 2022 Fudan University Applied Statistics real problem + analysis
- Mortal immortal cultivation pointer-1
- FAQs and answers to the imitation Niuke technology blog project (I)
- MySQL锁总结(全面简洁 + 图文详解)
- Zatan 0516
- 最新坦克大战2022-全程开发笔记-1
- About the parental delegation mechanism and the process of class loading
- 关于双亲委派机制和类加载的过程
- (ultra detailed onenet TCP protocol access) arduino+esp8266-01s access to the Internet of things platform, upload real-time data collection /tcp transparent transmission (and how to obtain and write L
猜你喜欢
使用Spacedesk实现局域网内任意设备作为电脑拓展屏
MPLS experiment
西安电子科技大学22学年上学期《基础实验》试题及答案
仿牛客技术博客项目常见问题及解答(一)
Pit avoidance Guide: Thirteen characteristics of garbage NFT project
5. Download and use of MSDN
C language Getting Started Guide
Mortal immortal cultivation pointer-2
Mortal immortal cultivation pointer-1
(超详细二)onenet数据可视化详解,如何用截取数据流绘图
随机推荐
vector
杂谈0516
FAQs and answers to the imitation Niuke technology blog project (III)
FAQs and answers to the imitation Niuke technology blog project (I)
Questions and answers of "signal and system" in the first semester of the 22nd academic year of Xi'an University of Electronic Science and technology
稻 城 亚 丁
学编程的八大电脑操作,总有一款你不会
PriorityQueue (large root heap / small root heap /topk problem)
[hand tearing code] single case mode and producer / consumer mode
2.初识C语言(2)
[graduation season · advanced technology Er] goodbye, my student days
Questions and answers of "Fundamentals of RF circuits" in the first semester of the 22nd academic year of Xi'an University of Electronic Science and technology
9.指针(上)
2022泰迪杯数据挖掘挑战赛C题思路及赛后总结
CorelDRAW plug-in -- GMS plug-in development -- Introduction to VBA -- GMS plug-in installation -- Security -- macro Manager -- CDR plug-in (I)
重载和重写的区别
The difference between abstract classes and interfaces
这次,彻底搞清楚MySQL索引
【九阳神功】2019复旦大学应用统计真题+解析
(超详细二)onenet数据可视化详解,如何用截取数据流绘图