标准输入、输出流

1、System 类

public final static InputStream in = null;
public final static PrintStream out = null;
  标准输入、输出流 编译类型 运行类型 默认设备
System.in 标准输入 InputStream BufferedInputStream 键盘
System.out 标准输出 PrintStream PrintStream 显示器

2、打印流

(1)只有输出流:PrintStream、PrintWriter

(2)没有输入流

3、PrintStream

(1)默认输出位置:显示器

(2)System 类的 setOut 方法,修改打印流的输出位置

public static void setOut(PrintStream out) {
    checkIO();
    setOut0(out);
}

(3)print 方法底层为 write 方法

4、PrintWriter,扩展 Writer,用法与 PrintStream 相似

posted @ 2022-03-29 21:55  半条咸鱼  阅读(40)  评论(0)    收藏  举报