BufferedReader最重要,因为有个方法public String readLine()
1 package System输入输出; 2 3 import java.io.BufferedReader; 4 import java.io.IOException; 5 import java.io.InputStreamReader; 6 7 public class Test { 8 public static void main(String[] args) throws IOException { 9 BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); 10 System.out.print("请输入数据:"); 11 String str=br.readLine(); 12 System.out.println(str); 13 } 14 }
不限制长度且无乱码输入
时间: 2024-10-10 10:00:32