package test;
import java.io.FileOutputStream;
import java.io.IOException;
public class OutputStreamReview {
/**
* 1.创建一个文件输出流对象
* 2.定义一个要输出的字符串,将其转化成byte数组
* 3.用文件输出流输出
*
*/
public static void main(String[] args) throws IOException {
// FileOutputStream(File file, boolean append) 是否追加。
FileOutputStream fos = new FileOutputStream("D:/qq/tft.txt",true);
// getBytes():将字符串转化成byte数组
byte[] b = "hello~world!".getBytes();
fos.write(b);
fos.close();
}
}