本文共 1005 字,大约阅读时间需要 3 分钟。
Checked exceptions–occurs at the compile time–compile time exceptions
File file = new File(“E://file.txt”); FileReader fr = new FileReader(file); 必须捕获或抛出FileNotFoundException否则编译不能通过Unchecked exceptions–occurs at the time of execution–Runtime Exceptions
int num[] = {1, 2, 3, 4}; System.out.println(num[5]); 运行时报java.lang.ArrayIndexOutOfBoundsExceptionErrors–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/