一:通过sanner类来获取键盘输入
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
System.out.println(str);
二:通过bufferedReader来获取键盘的输入
//2.通过BufferReader获取键盘输入
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
String s = bufferedReader.readLine();
System.out.println(s);