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());
        }
原文地址:https://www.cnblogs.com/lianghong881018/p/11244029.html