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

时间:2023-01-15 08:52:51

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);
}
}

不限制长度且无乱码输入