3 points · by robertp1984 · 12y ago · 1 comment
[1]:
Writer writer = null;
try {
writer = new FileWriter("/tmp/a");
writer.write("Line1");
writer.close();
} catch(FileNotFoundException e) {
// handle error
} catch (IOException ex) {
// handle error
}
[2]:
Writer writer = null;
try {
writer = new FileWriter("/tmp/a");
} catch(FileNotFoundException e) {
// handle error
} catch (IOException ex) {
// handle error
}
try {
writer.write("Line1");
} catch (IOException e) {
// handle error
}
try {
writer.close();
} catch (IOException e) {
// handle error
}