package J20250725;

import java.io.FileWriter;
import java.io.IOException;

/**
 * @author WanJl
 * @version 1.0
 * @title Demo08_FileWriter
 * @description
 * @create 2025/7/25
 */
public class Demo08_FileWriter {
    public static void main(String[] args) throws IOException {
        FileWriter fw=new FileWriter("D:/我的文件.txt",true);
        //写单个字符
        fw.write(97);
        fw.write('b');
        fw.write(99);
        //写入字符串
        fw.write("\tHello");
        fw.write("\nWorld");

        //写入字符数组
        char[] chars={'J','A','V','A'};
        fw.write(chars);
        //写入数组的一部分
        fw.write(chars,0,3);

        //写入一部分字符串
        fw.write("\n");
        fw.write("abcdefghijklmnopqrstuvwxyz",5,10);






        fw.close();
    }
}
