タグ

関連タグで絞り込む (2)

タグの絞り込みを解除

exceptionとjvmに関するmanabouのブックマーク (1)

  • try { return } finally {} | POSTD

    class Test { public int aaa() { int x = 1; try { return ++x; } catch (Exception e) { } finally { ++x; } return x; } public static void main(String[] args) { Test t = new Test(); int y = t.aaa(); System.out.println(y); } } 上の質問に回答する前に、次の問題には答えられるでしょうか? try ブロック内に return 文がある場合、 finally ブロックは return の実行時に処理されるのでしょうか。 finally が実行されるなら、いかにして return と finally の両方の実行が実現するのでしょうか。 もし答えが分からなければ、どうぞこのまま読み進め

    try { return } finally {} | POSTD
  • 1