[Java SE 7] 次世代Javaの動向 6 [dolphin]
■ このスレッドは過去ログ倉庫に格納されています
0647デフォルトの名無しさん
2008/04/19(土) 06:58:13きれいに書ける構文考えてくれよ。synchronized と違和感ないような (これもブロック抜けるときに
モニタ開放するし)。
try(Writer out = new FileWriter("foo.txt")){
...
} catch(IOException ex){...}
↓みたいな。二重tryでもいいや。
Writer out;
try{
out = new FileWriter("foo.txt")){
...
} catch(IOException ex){
...
} finally{
try{ if(out != null) out.close(); } catch(IOException ex){throw new RuntimeException(ex);}
}
■ このスレッドは過去ログ倉庫に格納されています