01——java IO流

时间:2015-10-29 23:18:13   收藏:0   阅读:247

java输入模板:

public class GameHelper {
    public String getUserInput(String prompt) {
        String inputLine = null;
        System.out.print(prompt + " ");
        try {
            BufferedReader is = new BufferedReader(new InputStreamReader(System.in));
            inputLine = is.readLine();
            if(inputLine.length() == 0) {
                return null;
            }
        }catch (IOException e) {
            System.out.println("IOException: " + e);
        }
        return inputLine;
    }
}

 

原文:http://www.cnblogs.com/yongssu/p/4921959.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!