Files
java-core-examples/exceptions/output/03-checked-vs-unchecked.txt
T

16 lines
1.1 KiB
Plaintext

=== which are checked? ===
Exception CHECKED Exception -> Throwable -> Object
IOException CHECKED IOException -> Exception -> Throwable -> Object
InterruptedException CHECKED InterruptedException -> Exception -> Throwable -> Object
RuntimeException unchecked RuntimeException -> Exception -> Throwable -> Object
IllegalArgumentException unchecked IllegalArgumentException -> RuntimeException -> Exception -> Throwable -> Object
NullPointerException unchecked NullPointerException -> RuntimeException -> Exception -> Throwable -> Object
Error unchecked Error -> Throwable -> Object
OutOfMemoryError unchecked OutOfMemoryError -> VirtualMachineError -> Error -> Throwable -> Object
StackOverflowError unchecked StackOverflowError -> VirtualMachineError -> Error -> Throwable -> Object
=== checked exception inside a stream lambda: wrap in UncheckedIOException ===
contents of a.txt
caught: java.io.UncheckedIOException: java.io.IOException: cannot read bad.txt
original cause: java.io.IOException: cannot read bad.txt