×
例外処理
検査例外(対処の義務あり)と非検査例外(対処の義務なし)のコードの違いです。
import java.io.FileReader;
import java.io.IOException;

public class ExceptionTypeExample {
    // 検査例外: throws または try-catch が必須
    public void read() throws IOException {
        FileReader fr = new FileReader("test.txt"); // FileNotFoundException
    }

    // 非検査例外: throws や try-catch なしでもコンパイル可能
    public void divide() {
        int result = 10 / 0; // ArithmeticException
    }
}

もう少し詳しく