字节输出流

package it_03;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class Demo9 {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos =new FileOutputStream("fos.txt");
//        fos.write(66);
//        byte[] b1 = {98,87,77,99,65};
//        String s1 ="sdad1516";
//        byte[] b2 = s1.getBytes();
//        fos.write(b2);
        for(int i=0;i<10;i++){
            fos.write("hello".getBytes());
            fos.write("\n".getBytes());
        }
        fos.close();

    }
}
posted @ 2025-04-22 16:16  lfqyj  阅读(6)  评论(0)    收藏  举报