码迷,mamicode.com
首页 > 编程语言 > 详细

java 输入挂

时间:2019-09-21 15:31:19      阅读:86      评论:0      收藏:0      [点我收藏+]

标签:edr   ble   buffer   adl   input   stream   字符串   span   more   

替换Scanner

    static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer tokenizer = new StringTokenizer("");
    static String nextLine() throws IOException {// 读取下一行字符串
        return reader.readLine();
    }
    static String next() throws IOException {// 读取下一个字符串
        while (!tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {// 读取下一个int型数值
        return Integer.parseInt(next());
    }

    static long nextLong() throws IOException {// 读取下一个long型数值
        return Long.parseLong(next());
    }

    static double nextDouble() throws IOException {// 读取下一个double型数值
        return Double.parseDouble(next());
    }

 

java 输入挂

标签:edr   ble   buffer   adl   input   stream   字符串   span   more   

原文地址:https://www.cnblogs.com/zuferj115/p/11562850.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!