请问哪里错了 (简单代码)

lth3185959 2012-10-06 09:49:29
import java.io.*;// you are importing the header files from the directory io in java , we put " * " at the end because that means everyfiles in that io directory is imported Source(s):
public class Sep59 {
public static void main(String[]args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//get noun
System.out.print("Enter your first number: ");
String ans1 = in.readLine();
//get adj
System.out.print("Enter your second number: ");
String ans2 = in.readLine();
//get adj
System.out.print("Enter your third number: ");
String ans3 = in.readLine();
//get verb
System.out.print("Enter your fourth number: ");
String ans4 = in.readLine();
//get adj
int x = ans1 + ans2 + ans3 + ans4
System.out.print("The total is" x);

}
}
...全文
184 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
小傅哥 2012-10-06
  • 打赏
  • 举报
回复
来吧 给我30QB吧 184172133 嘿嘿

import java.io.*;// you are importing the header files from the directory io in java , we put " * " at the end because that means everyfiles in that io directory is imported Source(s):
public class Sep59 {
public static void main(String[]args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//get noun
System.out.println("Enter your first number: ");
String ans1 = in.readLine();
//get adj
System.out.println("Enter your second number: ");
String ans2 = in.readLine();
//get adj
System.out.println("Enter your third number: ");
String ans3 = in.readLine();
//get verb
System.out.println("Enter your fourth number: ");
String ans4 = in.readLine();
//get adj 改动处:类型转换
int x = Integer.valueOf(ans1) + Integer.valueOf(ans2) + Integer.valueOf(ans3) + Integer.valueOf(ans4);
System.out.print("The total is" + x);

}
}
  • 打赏
  • 举报
回复
问一下啊,Q 币有什么用处?
进击的愤怒 2012-10-06
  • 打赏
  • 举报
回复
人家说要干嘛了吗,你就给他转整形了?![Quote=引用 1 楼 的回复:]

来吧 给我30QB吧 184172133 嘿嘿
Java code

import java.io.*;// you are importing the header files from the directory io in java , we put " * " at the end because that means everyfiles in that io directory ……
[/Quote]
V-003号 2012-10-06
  • 打赏
  • 举报
回复
流是资源,用完了可以关一下

23,407

社区成员

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

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