0
java-7の機能「正確な再暴走」とfinal Exception ex
について多くの質問がありますが、私の質問に対しては明確な答えが見つかりませんでした。「正確な再暴走」と最終的な例外との関係
"正確な再暴行"とfinal Exception
の関係は何ですか?
public static void main(String args[]) throws OpenException, CloseException {
boolean flag = true;
try {
if (flag){
throw new OpenException();
}
else {
throw new CloseException();
}
}
catch (final Exception e) {
System.out.println(e.getMessage());
throw e;
}
}
は、私は、「正確な再スロー」を使用したい場合は義務
final
キーワードを使用することですか?
catch (final Exception e) {
System.out.println(e.getMessage());
throw e;
}
それは必須ではない場合、私は新しい例外にex
参照を再割り当てすることができますか?
catch (Exception e) {
System.out.println(e.getMessage());
e=new AnotherException();
throw e;
}
「効果的に最終的に」とはどういう意味ですか? –
何も割り当てられていないことを意味します。私がリンクしている参照を読んでください!! –