本文共 373 字,大约阅读时间需要 1 分钟。
中,如何获取键盘输入呢?
看下面代码:
-
-
-
-
-
- public static String getStringKeyboard() throws IOException {
- InputStreamReader isr = new InputStreamReader(System.in);
- BufferedReader br = new BufferedReader(isr);
- String s = br.readLine();
- return s;
- }
-
- public static int getIntKeyboard() {
- Scanner sca = new Scanner(System.in);
- return sca.nextInt();
- }
测试:
转载地址:http://flcia.baihongyu.com/