特定の例外とその他の例外の 2 つのケースを処理するために、try-catch ブロックを使用したいと考えています。これはできますか?(例)
try{
Integer.parseInt(args[1])
}
catch (NumberFormatException e){
// Catch a number format exception and handle the argument as a string
}
catch (Exception e){
// Catch all other exceptions and do something else. In this case
// we may get an IndexOutOfBoundsException.
// We specifically don't want to handle NumberFormatException here
}
NumberFormatException は一番下のブロックでも処理されますか?