JavaSE InputStreamReaderDemo

package com.sxt;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;

public class InputStreamReaderDemo {
    public static void main(String[] args) throws IOException {
        Reader r = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(r);
        System.out.println("请输入姓名:");
        String name = br.readLine();
        System.out.println(name);
        br.close();
        r.close();
    }
}

你可能感兴趣的:(JavaSE InputStreamReaderDemo)