package cn.itcast.iostream;
/*
* 打印流,替换繁琐的输出流
* 不能替换输入
*/
import java.io.*;
public class TranseDemo3 {
public static void main(String[] args)throws Exception {
BufferedReader bfr = new
BufferedReader(new InputStreamReader(System.in));
//打印流,构造方法中,接收所有的字节输出流,字符输出流 System.out
PrintWriter pw = new PrintWriter(new FileOutputStream("c:\\123.txt"),true);
String line = null;
while((line = bfr.readLine())!=null){
if("over".equals(line))
break;
pw.println(line.toUpperCase());
}
pw.close();
bfr.close();
}
}
|