I'm using OutputStream
and InputStream
for reading and writing to a .properties file:
try (OutputStream output = new FileOutputStream(path)) {
// ...
output.close();
} catch (IOException e) {
e.printStackTrace();
}
try (InputStream input = new FileInputStream(path)) {
// ...
input.close();
} catch (IOException e) {
e.printStackTrace();
}
But my IDE says those close()
calls are redundant. If I don't close them will I have memory leaks? How does that work in Java? Thanks for help.