1. 程式人生 > >Java_基礎—字元流FileWriter

Java_基礎—字元流FileWriter

package com.soar.chario;

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

public class Demo2_FileWriter {
    /*
     * *FileWriter類的write()方法可以自動把字元轉為位元組寫出

        FileWriter fw = new FileWriter("aaa.txt");
        fw.write("aaa");
        fw.close();
     */
    public static void main(String[] args) throws
IOException { FileWriter fw = new FileWriter("yyy.txt"); fw.write("大家好,我是Soar_Sir!"); fw.write(97); fw.close(); } }