[Java 12 IO] BufferedReader 等待读取用户输入内容: bufferedReader.readLine();
BufferedReader --
new BufferedReader(new InputStreamReader(System.in));
package com.qunar.basicJava.javase.io; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * Author: libin.chen@qunar.com Date: 14-6-5 21:23 */ public class BufferedReaderDemo01 { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = null; // 带缓冲的字符输入流 bufferedReader = new BufferedReader(new InputStreamReader(System.in)); // System.in 字节输入流 InputStreamReader 转成 字符输入流 String str = bufferedReader.readLine(); // 等待读取用户输入内容 System.out.println("输入的内容为 : " + str); } }