写入数据到properties文件,执行成功,但是打开properties文件时发现数据不存在
public class Test {
public static void main(String[] args) {
Properties properties = new Properties();
String path = "data.properties";
File file = new File(path);
FileWriter fileWriter = null;
try {
fileWriter = new FileWriter(file);
} catch (IOException e) {
e.printStackTrace();
}
properties.setProperty("wmm", "123");
try {
properties.store(fileWriter,"first");
fileWriter.flush();
fileWriter.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
请问一下 大家 那个环节出了问题。