java 输入挂

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

 

posted on 2019-09-21 13:44  13rj1115  阅读(256)  评论(0编辑  收藏  举报

导航