public class ExceptionBasicExample {
public static void main(String[] args) {
try {
int result = 10 / 0; // 実行時に ArithmeticException が発生
System.out.println("結果: " + result);
} catch (ArithmeticException e) {
System.out.println("エラー発生: 0で割ることはできません。");
}
System.out.println("プログラムは安全に継続します。");
}
}