当前位置:网站首页>2. What is the difference between Exception and Error?
2. What is the difference between Exception and Error?
2022-08-03 06:22:00 【The yu classmate】
1. Exception: Some exceptions that may occur during the running of the program are required to be handled or captured by the program.It is because of the design of the program or some input and so on.
Exception is a kind of exception that may occur during java runtime, divided into runtime (unchecked exception) exception and non-runtime exception (checked exception).
1. Runtime exceptions: such as array access subscript out of bounds, null pointer exception, number conversion exception and so on.
Usually programs do not force us to catch such exceptions, but we are encouraged to do so.
2. Non-operation is abnormal: file does not exist, IO exception, etc.
Force we must handle this type of exception: catch it with a try-catch block in the current class, or throw an exception with throws.
The exception is only possible, it does not mean that it must appear, but for this possibility, we will deal with the possibility of this exception in advance.
Second, Error: A system-level error that the program does not have to deal with.For example, insufficient memory space, hardware problems, etc.For this kind of error, the program is basically powerless, and has no choice but to exit the program, which is usually thrown by the java virtual machine.
边栏推荐
猜你喜欢
随机推荐
servlet学习(七)ServletContext
ARMv8 架构----armv8 类别
What is parametric design, let's understand it through practical operation?| SOLIDWORKS How-To Videos
中空编码器的作用——唯样商城
ucos任务调度原理
POE交换机全方位解读(中)
ZEMAX | 探究 OpticStudio 偏振分析功能
常见的电子元器件分类介绍-唯样商城
6. What is the difference between Vector, ArrayList and LinkedList?(design, performance, safety)
三分钟看懂二极管的所有基础知识点
数组与字符串8-最长回文子串
稳压二极管的工作原理及稳压二极管使用电路图
二分查找6 - 寻找峰值
电容器和电池有什么不同?
全球一流医疗技术公司如何最大程度提高设计工作效率 | SOLIDWORKS 产品探索
零基础小白想往游戏建模方向发展,3D游戏建模好学嘛?
自监督论文阅读笔记 DetCo: Unsupervised Contrastive Learning for Object Detection
二分查找4 - 搜索旋转排序数组
2021-03-22
3d建模师为什么不建议入行









