>>966
完璧にやるなら下のようになる。ただし日常的にここまでやる奴はキチガイ。
原発のシステムならいいかもね。
>>967の方針でも、最悪GC時にfinalize()が走ってリソースのclose()は実行される。

FileOutputStream fos = null;
OutputStreamWriter osw = null;
BufferedWriter bw = null;
PrintWriter pw = null;
try {
  try {
    pw = new PrintWriter(bw = new BufferedWriter(osw = new OutputStreamWriter(fos = new FileOutputStream(filename), "Windows-31J")));
    pw.println("Hello, World!");
  } finally {
    if (pw != null) {
      pw.close();
    } else if (bw != null) {
      bw.close();
    } else if (osw != null) {
      osw.close();
    } else if (fos != null) {
      fos.close();
    }
  }
} catch (IOException e) {
  throw new RuntimeException(e);
}