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

 

posted @ 2019-07-25 14:27  嵌入式实操  阅读(125)  评论(0编辑  收藏  举报