Skip to content

Instantly share code, notes, and snippets.

@ageldama
Created November 5, 2012 14:58
Show Gist options
  • Select an option

  • Save ageldama/4017588 to your computer and use it in GitHub Desktop.

Select an option

Save ageldama/4017588 to your computer and use it in GitHub Desktop.
예외가 있을때와 없을때.
/* 예외를 사용하지 않을때. */
File file = openFile();
if (file == null) {
return null;
}
String contents = file.readAll();
return contents;
/* 예외를 사용할때. */
File file = null;
try {
file = openFile();
return file.readAll();
} finally {
if (file != null) closeFile(file);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment