x = x + i;
but this is not:
x += i;
Solution:
Objext x = "Buy ";
Stirng i = "Effective java!";
x = x + i;//it's legal.显示:But Effective java!
x += i; //it's illegal.因为+=操作符没有对String类型的定义。
TID:
The += operator allows its right-hand operand to be of any type if the variable on
the left-hand side is of type String, in which case the operator performs string
concatenation.