新手 提问 程序不知道怎么改

zhanyu1888 2006-04-20 10:01:10
import java.io.*;
public class test2
{
public static void main(String[] args)
{ float n=0;
System.out.println("please input a number:");
n=(float)System.in.read();
int i;float j;
i=(int)n;
j=n-i;
System.out.println("整数部分="+i+";"+"小数部分等于"+j);
}
}

请高手指点
...全文
64 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
china2685920 2006-04-20
  • 打赏
  • 举报
回复
import java.io.*;
public class test2
{
public static void main(String[] args) throws IOException //缺少throws IOException
{ float n=0;
System.out.println("please input a number:");
n=(float)System.in.read();
int i;float j;
i=(int)n;
j=n-i;
System.out.println("整数部分="+i+";"+"小数部分等于"+j);
}
}

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧