private static String savefile = "E:\\test.txt";
private static void saveAsFileWriter(String content) {
FileWriter fwriter = null;
try {
fwriter = new FileWriter(savefile);
fwriter.write(content);
} catch (IOException ex) {
ex.printStackTrace();
} finally {
try {
fwriter.flush();
fwriter.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
java将一个string保存到txt文档中
最新推荐文章于 2024-08-15 19:25:02 发布