-
常见的 OutOfMemoryError, StackOverflowError 不是直接继承Error而是在Error =>VirtualMachineError
– StackOverflowError:Thrown when a stack overflow occurs because an application recurses too deeply.(递归过深)
– OutOfMemoryError:Thrown when the Java Virtual Machine cannot allocate an object because it is out of memory, and no more memory could be made available by the garbage collector. OutOfMemoryError objects may be constructed by the virtual machine as if suppression were disabled and/or the stack trace was not writable.(空间不足) -
checked exception和unchecked exception
继承Exception来实现checked exception (IDE会提示处理异常)
继承RuntimeException实现unchecked exception (IDE不提示,程序运行过程中有错误才会报错)
java 异常
最新推荐文章于 2024-03-24 20:22:05 发布