当前位置:网站首页>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.
边栏推荐
猜你喜欢
数组与字符串13-两数之和等于目标数
3D建模:做什么副业在家就能月入1W?
How the world's leading medical technology company maximizes design productivity | SOLIDWORKS Product Exploration
贴片电阻的结构是怎样的?唯样商城
大学毕业后,零基础想转行成为一名3D建模师,现在该做什么?
VS2022 encapsulation under Windows dynamic library and dynamic library calls
2021-03-22
稳压二极管的工作原理及稳压二极管使用电路图
电子元器件的分类有哪些?
NIO知识汇总 收藏这一篇就够了!!!
随机推荐
大学毕业后,零基础想转行成为一名3D建模师,现在该做什么?
ucosII OSMemCreate()函数的解析
cmdline -[command line,__fdt_pointer,initial_boot_params] boot_command_line 获取
SolidWorks 操作视频 | 隐藏高手必备工具Defeature,让设计隐藏更彻底
Windos 内网渗透之Token的使用
数组与字符串13-两数之和等于目标数
自监督论文阅读笔记FIAD net: a Fast SAR ship detection network based on feature integration attention and self
树——前序
MySql【后面附有练习题】
MATLAB给多组条形图添加误差棒
自监督论文阅读笔记 Multi-motion and Appearance Self-Supervised Moving Object Detection
ZEMAX | How to rotate any element around any point in space
二分查找4 - 搜索旋转排序数组
ZEMAX | 如何使用ZOS-API创建自定义操作数
ZEMAX | 探究 OpticStudio 偏振分析功能
贴片电阻的结构是怎样的?唯样商城
【第四周】MobileNet和HybridSN
AI智能剪辑,仅需2秒一键提取精彩片段
All-round interpretation of POE switches (middle)
使用ZBrush制作恶魔模型