search

Home  >  Q&A  >  body text

java - += 和 + 运算之后赋值有什么区别

巴扎黑巴扎黑2912 days ago395

reply all(2)I'll reply

  • PHPz

    PHPz2017-04-18 10:45:20

    Why is the second sentence wrong?
    Because the sum of short and int is not equal to short, and the value is assigned to short without forced conversion
    += implicitly includes the result of forced conversion as short

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-18 10:45:20

    Post a link, it has been explained very clearly.
    https://my.oschina.net/u/2411...

    reply
    0
  • Cancelreply