Skip to content

Latest commit

 

History

History
21 lines (17 loc) · 460 Bytes

unchecked_exceptions.md

File metadata and controls

21 lines (17 loc) · 460 Bytes

Unchecked Exceptions

When a part of your code might throw a "unchecked" exception, other parts of your code do not need to account for that possibility.

int divide(int x, int y) {
    if (y == 0) {
        // Will work because you are not forced to handle
        // an unchecked exception
        throw new RuntimeException();
    }

    return x / y;
}
~void main() {
~    
~}

We call them unchecked because you don't need to check for them.