throws

A method declaration clause listing exceptions callers may need to handle.

What does throws do in Java?

throws — A method declaration clause listing exceptions callers may need to handle.

import java.io.IOException;

class OrderReader {
    String read() throws IOException {
        throw new IOException("Unavailable");
    }
}

Level: Journeyman · More Java terms at this level

Updated