谁在帮我看下这段程序错误的地方啊,整型转换的有问题!急

piovt25728 2008-03-06 04:00:52
public static void TodeleteBook() throws IOException
{
InputStreamReader iin = new InputStreamReader(System.in);
BufferedReader bin = new BufferedReader(iin);

String temp = bin.readLine();
BookDao bookdao = new BookDao();
Book book = new Book();
System.out.print("请输入书籍编号:");
int m = Integer.parseInt(System.in.read());
try{
book.setId(m);
}
catch(ParseException ex){
ex.printStackTrace();
}
bookdao.deleteBook(book);
}

红色部分有问题,错误提示如下:The method parseInt(String) in the type Integer is not applicable for the arguments (int)
...全文
89 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
ochinchina 2008-03-06
  • 打赏
  • 举报
回复
public static void TodeleteBook() throws IOException
{
InputStreamReader iin = new InputStreamReader(System.in);
BufferedReader bin = new BufferedReader(iin);

String temp = bin.readLine();
BookDao bookdao = new BookDao();
Book book = new Book();
System.out.print("请输入书籍编号:");
int m = Integer.parseInt(bin.readLine().trim() );
try{
book.setId(m);
}
catch(ParseException ex){
ex.printStackTrace();
}
bookdao.deleteBook(book);
}
mouse5s306 2008-03-06
  • 打赏
  • 举报
回复
这样改一下看看

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int i = Integer.parseInt(br.readLine());
System.out.println(i);
ai7090 2008-03-06
  • 打赏
  • 举报
回复
int m = Integer.valueOf(System.in.read()).intValue();
这样不知道可不可以.

62,623

社区成员

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

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