| |
| 输入输出类 |
| |
发布者: 发布时间:2007-11-26 |
|
|
|
import java.io.*;public class KeyboardInput{private final BufferedReader in=new BufferedReader(new InputStreamReader(System.in));public final synchronized int readInteger(){String input="";int value=0;try{input=in.readLine();}catch (IOException e){}if(input!=null){try{value=Integer.parseInt(input);}catch(NumberFormatException e){}}return value;}public final synchronized long readLong(){String input="";long value=0L;try{input=in.readLine();}catch (IOException e){}if(input!=null){try{value=Long.parseLong(input);}catch(NumberFormatException e){}}return value;}public final synchronized double readDouble(){String input="";double value=0.0D;try{input=in.readLine();}catch (IOException e){}if(input!=null){try{value=Double.parseDouble(input);}catch(NumberFormatException e){}}return value;}public final synchronized float readFloat(){String input="";float value=0.0F;try{input=in.readLine();}catch (IOException e){}if(input!=null){try{value=Float.parseFloat(input);}catch(NumberFormatException e){}}return value;}public final synchronized char readCharacter(){char c=;try{c=(char)in.read();}catch (IOException e){}return c;}public final synchronized String readString(){String s="";try{s=in.readLine();}catch (IOException e){}if(s==null){s="";}return s;}}
|
| (转载文章请保留出处:北天JAVA技术网(www.java114.com)) |
| |
| 更多精彩文章: |
| Java中应用Filter对权限和Session控制 |
| 对于JAVA基础测试中常见的异常问题汇总 |
| Java语言相关的重要术语解析 |
| 如何使用Java编写NT服务 |
| JAVA语言基础:现在你还在用if else吗? |
| 成为java高手的八大条件 |
| |
| 最近评论: |
|
|
| 鍥炲 |
|
|
|
| 那个雨天的想法! |
| wow gold,wow power leveling.wow power leveling,wow power leveling,
max(9083) |
|
|
| 如果真的有来生! |
| 四川旅游,九寨沟旅游,稻城亚丁旅游,四姑娘山旅游,海螺沟旅游,西藏旅游,
max(6295) |
|
|
| 那天的情景! |
| Maple Story mesos,MapleStory mesos,ms mesos,mesos,SilkRoad Gold,
max(4912) |
|
|
| 如果真的有来生! |
| 四川旅游,九寨沟旅游,稻城亚丁旅游,四姑娘山旅游,海螺沟旅游,西藏旅游,
max(9594) |
|
|
| 左边的风景! |
| wow gold,wow power leveling.wow power leveling,wow power leveling,
max(1870) |
|
|
| 轻轻走过你的窗前! |
| world of warcraft gold,cheap world of warcraft gold,warcraft gold,world of warcraft gold,cheap world of warcraft gold,warcraft gold max(7021) |
|
|
| 不在的哪天! |
| final fantasy xi gil,final fantasy xi gil,final fantasy xi gil,final fantasy xi gil,
max(5267) |
|
|
| 快乐情人节! |
| wow gold,wow gold,wow gold,wow gold,wow gold,wow gold,wow gold buy wow gold for cheap.
max(2527) |
|
|
| 昨夜的狂想曲! |
| wow gold,WoW Gold,world of warcraft gold,WoW Gold, max(9045) |
|
|
| |
| 免责声明:该文章由网友发表,如果对您造成侵权,请联系站长。 |
|