两个Number类型的变量相加,如何写这个语句(在线等)

cnredarrow 2004-10-09 01:05:14
比如两个Number变量a,b
等到 a = a + b
怎么写?
...全文
640 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
ladofwind 2004-10-09
  • 打赏
  • 举报
回复
Number a = new Integer(4);
Number b = new Integer(40);
Number c = new Integer(a.intValue()+b.intValue()) ;
chenxb1980 2004-10-09
  • 打赏
  • 举报
回复
Number a = new Integer(4);
Number b = new Integer(40);
Number c = new Integer(a.intValue()+b.intValue()) ;
cnredarrow 2004-10-09
  • 打赏
  • 举报
回复
那么写报错的
sxiaofen 2004-10-09
  • 打赏
  • 举报
回复
你直接就照你的那个式子不就可以了,那样没有问题,除非你想干点别的
cnredarrow 2004-10-09
  • 打赏
  • 举报
回复
up
windust3313 2004-10-09
  • 打赏
  • 举报
回复
不太明白你的意思咧
cnredarrow 2004-10-09
  • 打赏
  • 举报
回复
是int的
ladofwind 2004-10-09
  • 打赏
  • 举报
回复
看Number具体里面是什么类型了

81,122

社区成员

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

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