博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Java异常分类
阅读量:4101 次
发布时间:2019-05-25

本文共 1005 字,大约阅读时间需要 3 分钟。

checked exception

Checked exceptions–occurs at the compile time–compile time exceptions

File file = new File(“E://file.txt”);
FileReader fr = new FileReader(file);
必须捕获或抛出FileNotFoundException否则编译不能通过

Unchecked exception

Unchecked exceptions–occurs at the time of execution–Runtime Exceptions

int num[] = {1, 2, 3, 4};
System.out.println(num[5]);
运行时报java.lang.ArrayIndexOutOfBoundsException

Errors

Errors–beyond the control of the user or the programmer–also ignored at the time of compilation

Errors are generated to indicate errors generated by the runtime environment. Example: JVM is out of memory. Normally, programs cannot recover from errors.

另一种分类

JVM Exceptions −

These are exceptions/errors that are exclusively or logically thrown by the JVM.
Examples: NullPointerException, ArrayIndexOutOfBoundsException, ClassCastException.

Programmatic Exceptions − These exceptions are thrown explicitly by the application or the API programmers. Examples: IllegalArgumentException, IllegalStateException.

转载地址:http://qjbsi.baihongyu.com/

你可能感兴趣的文章
9.1 为我们的角色划分权限
查看>>
维吉尼亚之加解密及破解
查看>>
DES加解密
查看>>
TCP/IP协议三次握手与四次握手流程解析
查看>>
PHP 扩展开发 : 编写一个hello world !
查看>>
inet_ntoa、 inet_aton、inet_addr
查看>>
用模板写单链表
查看>>
用模板写单链表
查看>>
链表各类操作详解
查看>>
C++实现 简单 单链表
查看>>
数据结构之单链表——C++模板类实现
查看>>
Linux的SOCKET编程 简单演示
查看>>
正则匹配函数
查看>>
Linux并发服务器编程之多线程并发服务器
查看>>
聊聊gcc参数中的-I, -L和-l
查看>>
[C++基础]034_C++模板编程里的主版本模板类、全特化、偏特化(C++ Type Traits)
查看>>
C语言内存检测
查看>>
Linux epoll模型
查看>>
Linux select TCP并发服务器与客户端编程
查看>>
Linux系统编程——线程池
查看>>