byte[] buf = new byte[256];
try {
// input
String str="";
do{
int c = System.in.read(buf,0,buf.length);
str += new String(buf,0,c);
}while(System.in.available()>0) ;
str = str.substring(0,str.length()-1); // remove the last return
}catch(Exception){e.printStackTrace();}
try {
double value = Double.parseDouble(str);
}catch(Exception e){e.printStackTrace();}
try {
// input
String str="";
do{
int c = System.in.read(buf,0,buf.length);
str += new String(buf,0,c);
}while(System.in.available()>0) ;
str = str.substring(0,str.length()-1); // remove the last return
}catch(Exception){e.printStackTrace();}
try {
double value = Double.parseDouble(str);
}catch(Exception e){e.printStackTrace();}
解决方案 »
- 请问 提取文本框中的输入数字到自己的算法中怎么总有错误
- Java Dom 解析出现Unknown Source
- 菜鸟发问
- 帮我看看为什么结果是True
- j2se程序执行顺序
- 问几个常见的面试问题,大家发表一下意见!
- JAVA、J2SE、J2EE、J2ME、JSP怎么理解?
- java中如何实现在忙操作时鼠标变为漏斗状
- 如何获得刚插入数据的id递增值
- 求救!SimpleIO.java:9: variable c might not have been initialized System.out.println("The letter is : "+c); ^ 1 error
- 如何有效的在java应用程序中画图(就是显示图片)
- 看看这段《java2编程详解》的源码有什么不对的吗?
Number n = df.parse(s);
double x=n.doubleValue();