Java 如何将字符串信息直接写娴轿谋疚募
发布网友
发布时间:2022-04-25 00:16
我来回答
共1个回答
热心网友
时间:2023-11-08 06:46
String s = "akjibuvuvu";
FileWriter fw = null;
File f = new File("a.txt");
try {
if(!f.exists()){
f.createNewFile();
}
fw = new FileWriter(f);
BufferedWriter out = new BufferedWriter(fw);
out.write(s, 0, s.length()-1);
out.close();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("end");