
正文
learning java 获取键盘输入
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
通过Scanner类,获取键盘的输入
var sc = new Scanner(System.in);
// while (sc.hasNext()){
// System.out.println("key context : " + sc.next());
// }
//while (sc.hasNextLong()){
// System.out.println("key context : " + sc.nextLong());
//}
while (sc.hasNextLine()){
System.out.println("key context : " + sc.nextLine());
}







