带+运算符的Java字符串串联

带+运算符的Java字符串串联,第1张

带+运算符的Java字符串串联

加法保持关联。以第一种情况

20+30+"abc"+(10+10)-----       -------  50 +"abc"+  20    <--- here both operands are integers with the + operator, which is addition  ---------  "50abc"  +  20    <--- + operator on integer and string results in concatenation    ------------      "50abc20"     <--- + operator on integer and string results in concatenation

在第二种情况下:

20+30+"abc"+10+10-----  50 +"abc"+10+10  <--- here both operands are integers with the + operator, which is addition  ---------   "50abc"  +10+10  <--- + operator on integer and string results in concatenation    ----------    "50abc10"  +10  <--- + operator on integer and string results in concatenation     ------------      "50abc1010"   <--- + operator on integer and string results in concatenation


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5428107.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-11
下一篇 2022-12-11

发表评论

登录后才能评论

评论列表(0条)

保存