【java】缓冲字符字节输入输出流:java.io.BufferedReader、java.io.BufferedWriter、java.io.BufferedInputStream、java.io.BufferedOutputStream

BufferedReader最重要,因为有个方法public String readLine()

 package System输入输出;

 import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader; public class Test {
public static void main(String[] args) throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("请输入数据:");
String str=br.readLine();
System.out.println(str);
}
}

不限制长度且无乱码输入

上一篇:在CentOS上为Docker开启SELinux


下一篇:Hadoop基础-Map端链式编程之MapReduce统计TopN示例