用的BufferedRead和PrintWriter
- package com.cn.filedemo;
- import java.io.*;
- public class PrintSteamDemo {
- public static void main(String[] args) throws Exception {
- BufferedReader br=new BufferedReader(new InputStreamReader(System.in));//读取键盘
- PrintWriter pw=new PrintWriter(System.out,true);//第二个参数设置为true能自动刷新
- String line=null;
- while((line=br.readLine())!=null){//输入到输出
- pw.println(line.toUpperCase());
- }
- br.close();
- pw.close();
- }
- }
复制代码 |
|