1、[简答题] 【高效字节输出流写出字节数据】 描述:利用高效字节输出流往C盘下的d.txt文件输出一个字节数。
1、[简答题] 【高效字节输出流写出字节数据】
描述:利用高效字节输出流往C盘下的d.txt文件输出一个字节数。
//day10作业byzhang 2022/6/2
package day_10_test;
import java.io.BufferedOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
//1、[简答题] 【高效字节输出流写出字节数据】
//描述:利用高效字节输出流往C盘下的d.txt文件输出一个字节数。
public class Test01 {
public static void main(String[] args) throws IOException {
//创建字节输出流FileOutputStream 并指向绝对路径
FileOutputStream fos = new FileOutputStream("C:\\d.txt");
//创建高效字节流输出对象
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fos);
//利用高效字节输出流write(int byte)方法写出一个字节数据
bufferedOutputStream.write(97);
bufferedOutputStream.close();
}
}