a=DateOutputStream(new fileOutput(path)).writelong(1234567) :数据流写入二进制给计算机识别的方式写进a中
b=PrintStream(path).println(1234567):人们习惯的看得的字符形式写入b中
PrintStream p1=new PrintStream(path);
写入:p1.printIn(“反抗螺丝钉jfk速度”);
还可以把屏幕输出到p1中,
System.setOut(p1);
System.out.println(“中国附近的说法就是打 jfk了的司法鉴定所”);
try{
a=new PrintStream(path1)
b=new PrintStream(path2)
ss=new Scanner(System.in)
int shuzi ;
System.setout(a):正确的写入到path1
System.seterr(b):错误的写入到path2
while(true)
{
shuzi=ss.nextInt();
System.out.println(shuzi);
}
}
catch(Exception e)
{
System.err.println(“输入有误”);
当输入有误时这句话会输出到b中
}