这个连接包含了常用的流------IO流(总篇章)  



PrintStream(String fileName):使用指定的文件名创建新的打印流



特点


  • 只负责输出数据,不负责读取数据
  • 有自己的特有方法


package com.testIO;

import java.io.*;

/**
* @author 林高禄
* @create 2020-05-12-16:16
*/
public class PrintStreamDemo {
public static void main(String[] args) throws IOException{
PrintStream ps = new PrintStream("test//src//com//testIO//c.txt");
ps.write(97);
ps.println(97);
ps.println("林高禄");
ps.close();
}
}


 c.txt文件内容为:

a97 林高禄


发现字节打印流的​write()​方法会转码为a,而特有的方法​println()​方法等写多少就是多少,不会转码