Keyboard类源码

import java.io.*;
public class Keyboard {
    static BufferedReader inputStream=new BufferedReader(new InputStreamReader(System.in));
    public static int getInteger() {
        try {
            return (Integer.valueOf(inputStream.readLine().trim()).intValue());
        }catch(Exception e) {
            e.printStackTrace();
            return 0;
        }
    }
    public static String getString() {
        try {
            return (inputStream.readLine());
        }catch(IOException e) {
            return "0";
        }
    }
}

猜你喜欢

转载自blog.csdn.net/cameles/article/details/80305050