をコンパイル示しています。私のソースコードがある私はInputMismatchExceptionをキャッチしたいが、それはコンパイル中に、私は次のエラーを取得する時エラー
filimon.java:12: error: cannot find symbol
}catch(InputMismatchException ime){
^
symbol: class InputMismatchException
location: class filimon
1 error
:
class filimon{
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
try{
System.out.println("enter 2 integer values");
int a=s.nextInt();
int b=s.nextInt();
System.out.println("value of a: "+a);
System.out.println("value of b: "+b);
}catch(InputMismatchException ime){
System.err.println("please enter only number value");
}
catch(Exception e){
System.err.println(e);
}
}//main
}//filimon
問題は何ですか?私を助けてください。
あなたの輸入品は何ですか? –
間違いなく、どのパッケージが 'InputMismatchException'型を保持しているかをコンパイラに認識されていません。また、あなたは例外を処理しないし、 'catch(Exception e)'は反パターンである。命名規則に従ってください。 –