System类的3个成员变量:in,out,err

package demo;

import java.io.IOException;
import java.io.InputStream;

public class SystemIODemo {

public static void main(String[] args) throws IOException {
//System类的3个成员变量:in,out,err
InputStream input=System.in; //标准输入(键盘)
System.out.print("请输入:"); //标准输出(屏幕)
byte[] buf=new byte[256];
int len=input.read(buf);
System.out.println("收到的消息:"+new String(buf,0,len));
System.err.println("收到的消息:"+new String(buf,0,len));
}

}

posted @ 2022-05-14 16:03  fighterk  阅读(68)  评论(0)    收藏  举报