I am using try with resources, and I found if I use the out statement, then I get something wrong
Correct one,
try (FileWriter fstream = new FileWriter(mergedFile, true);) { } Incorrect one
FileWriter fstream = null; try (fstream = new FileWriter(mergedFile, true);) { } I am wondering why I cannot use the second one? The scope of with resources is different?
try-with-resourcesblock only exist inside it and are closed automatically when the block is left.