Java03 InputLine
来源:互联网 发布:京东小程序源码 编辑:程序博客网 时间:2024/04/30 08:40
It’s not easy for newcomer to learn java-application’s iostream.
Now from what I learn, I should creat a Reader to read what the user type, then create a BufferedReader to store the keywords.After doing that I can create String to readLine().
Here is the methods:
public static String inputLine() {
BufferedReader br = null;
Reader r = new InputStreamReader(System.in);
br = new BufferedReader(r);
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
By the way,When I want to get an int,I shoule convert the string.
Integer.parseInt(inputLine());
- Java03 InputLine
- JAVA03
- 学习java03
- 初学JAVA03
- [java03]java字符串
- Java03接口与内部类
- Java03-while语句,for语句、函数
- 重拾Java回忆录(三):Java03类的特性
- 高效Java03:使用私有构造器或枚举类型强化单例属性
- Android 利用方向传感器获得手机的相对角度
- HashMap深度挖掘
- 人见人爱A^BmodC的二分思想
- 客户/服务器程序设计模板(一)服务器
- mvn No Android SDK path could be found
- Java03 InputLine
- 视频会议十大开源项目排行
- java中的字节流和字符流的存储区别
- 百度绿萝算法更新了严抓外链
- 使用SQLite储存数据
- 【cocos2d-x官方文档】动画 Animations
- Oracle 字符集的查看和修改
- Oracle中的character set 和 national character set
- Java菜鸟学习笔记--配置篇(三):Java API 文档下载与文档注释的使用