Tôi đã mã sau:làm thế nào để đóng FileInputStream trong khi đọc các tập tin bất động sản
// Read properties file.
Properties properties = new Properties();
try {
properties.load(new FileInputStream("filename.properties"));
} catch (FileNotFoundException e) {
system.out.println("FileNotFound");
}catch (IOException e) {
system.out.println("IOEXCeption");
}
Có cần thiết để đóng FileInputStream? Nếu có, làm thế nào để tôi làm điều đó? Tôi đang gặp phải lỗi thực hành không tốt trong danh sách kiểm tra mã của tôi. Yêu cầu nó đặt cuối cùng khối.
"Thuộc tính thuộc tính = mới" - sai. – duffymo