Grokking Java Interview Questions
Vote

0% completed

​

Checked and Unchecked Exceptions

Two calls can both fail while a program runs. Integer.parseInt("12a") throws NumberFormatException, because the text is not a number. Files.readString(file) throws an IOException when the file cannot be read. The compiler accepts the first call as it is, and it rejects the second one until the code around it changes.

Two kinds of exception produce this difference. The questions below separate the two kinds, place errors beside them, show when a method should use the stricter kind, and state what an overriding method may declare.

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content