import java.io.*; //键盘读入 字节流转换成字符流操作 提高效率 public class io { public static void main(String[] args) throws IOException { /* 获取键盘录入对象 循环 InputStream in = System.in; 将字节流对象转成字符流对象 试用转换流 InputStreamReader isr = new InputStreamReader(in); 为了提高效率 将字符串进行缓冲区技术高效操作 使用BufferedReader BufferedReader bufr = new BufferedReader(isr); */ //三句话合并一句 BufferedReader bufr = new BufferedReader(new InputStreamReader(System.in)); /* OutputStream out = System.out; OutputStreamWriter osw = new OutputStreamWriter(out); BufferedWriter bufw = new BufferedWriter(osw); */ //合并后 BufferedWriter bufw = new BufferedWriter(new OutputStreamWriter(System.out)); String line = null; while((line=bufr.readLine())!=null)//从输入中读出 { if("over".equals(line)) //键盘输入结束标志位 默认Ctrl+C结束 break; //从键盘读入流输出 System.out.println(1+line.toUpperCase()); //从写出流输出 bufw.write(2+line.toUpperCase()); bufw.newLine(); bufw.flush(); } bufr.close(); bufw.close(); } }
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240825082459112-376424429.jpg)