Code Fix

上級unreported exception must be caught の原因と直し方 › パターン2

unreported exception must be caught の原因と直し方

検査例外と非検査例外の境界。

 1  public class Main {
 2      public static void main(String[] args) {
 3          try {
 4              Thread.sleep(10);
 5          } _______ (InterruptedException e) {
                 ^
 6              System.out.println("interrupted");
 7          }
 8      }
 9  }
Main.java:5: error: ';' expected

空欄を埋めてビルドを通す

広告
広告スロット(未設定)

unreported exception must be caught の原因と直し方

throwとthrowsの違い、catchできない型の条件を扱います。

このエラーの解説と類題をまとめて見る →

広告
広告スロット(未設定)