import java.text.*;
public class HelloWorld { public static void main(String[] args) {
System.out.println("hello world!");
System.out.println("please input a number:"); //这里该怎么写?
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
try
{
int x = Integer.parseInt(in.readLine());
}
catch (IOException e)
{
System.out.println("wrong");
}
System.out.println(x);
int y = 20;
double number = x/(double)y ;
NumberFormat format = NumberFormat.getPercentInstance();
format.setMaximumFractionDigits(4);
if (format instanceof DecimalFormat)
{
System.out.println(((DecimalFormat)format).format(number));
}
}
}
public class HelloWorld { public static void main(String[] args) {
System.out.println("hello world!");
System.out.println("please input a number:"); //这里该怎么写?
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
try
{
int x = Integer.parseInt(in.readLine());
}
catch (IOException e)
{
System.out.println("wrong");
}
System.out.println(x);
int y = 20;
double number = x/(double)y ;
NumberFormat format = NumberFormat.getPercentInstance();
format.setMaximumFractionDigits(4);
if (format instanceof DecimalFormat)
{
System.out.println(((DecimalFormat)format).format(number));
}
}
}
解决方案 »
- java.lang.NullPointerException at android.graphics.Canvas.throwIfRecycled
- JLabel图片保持更新的问题
- IO中递归删除文件问题
- SCJP考题一道:Java desk application's possible exceptions.
- 帮忙修改一下一个小程序(偶自己不懂JAVA),谁帮我忘APPLET显示的计算器上多显示一行文本?
- 学了基本的java 语言,学那种技术先好呢?
- 简单问题,用JCreator的请赐教!
- 我学JAVA(JSP,写JAVABEAN,SERVLET,JSP+MS SQL 做网上构物系统)有一段时间了,可以到现在还是一头雾水!还不知道JAVA倒底是做什么的
- 如何更改鼠标指针?
- 怎样监听JTableHeader的事件,比如希望判断点击某一列表头.
- java.sql.Timestamp对象 如何插入数据库中的日期字段中
- Ireport开发报表页面设置问题 高手进
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));