InputStreamReader和OutputStreamWriter实例

作者在 2010-05-21 14:37:33 发布以下内容
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;

public class TestStandardInput{
    public static void main (String args[]) {
        String s;
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        try {
            s = br.readLine();
            while (!s.equals("")) {      
                System.out.println("Read: " + s);
                s = br.readLine();
            }
            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
I/O编 | 阅读 1125 次
文章评论,共0条
游客请输入验证码
浏览290925次