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));
}
}

浙公网安备 33010602011771号