Language syntax

Java Checked exceptions

A checked failure escaping a method must be handled or declared.

Formal Syntax & Structure

java syntaxjava
void load() throws IOException

Working Example

Example Snippetjava
public class Main {    static void verify(boolean ready) throws java.io.IOException {        if (!ready) throw new java.io.IOException("Catalog unavailable");    }    public static void main(String[] args) {        try { verify(false); }        catch (java.io.IOException e) { System.out.println(e.getMessage()); }        System.out.println("Ready for next request");    }}
Java Reference