package day0829;
/*
* 用System.in获取键盘输入
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class SystemIn {
public static void main(String[] args) throws IOException {
//System.in 返回的是一个InputStream
InputStream is = System.in;
//为了更好的处理文本,将字节流转换为字符流
InputStreamReader isr = new InputStreamReader(is);
//将转换好的字符流传入缓冲流
BufferedReader br = new BufferedReader(isr);
System.out.println("请输入一串字符");
String str = br.readLine();
System.out.println(str);
}
}
|
|