java如何写入txt文件

public class TxtWrite {

    public static void main(String args[]){
contentToTxt("D:\\xyky.txt","3");
}
public static void contentToTxt(String filePath, String content) {
try{
BufferedWriter writer = new BufferedWriter(new FileWriter(new File(filePath),true));
writer.write("\n"+content);
writer.close();
}catch(Exception e){
e.printStackTrace();
}
}
}
 
 
 
上一篇:gitbook 入门教程之发布电子书


下一篇:django+nginx+gunicorn+pipenv微信小程序实践笔记