它是按顺序来的,首先是前计算前两个,其中如果有字符串“”,那么就按字符串相加,
‘a’是字符,不是字符串,所以基于你的我也写了个小例子希望能帮助到你:
String s2 = "123HelloWorld"; //123HelloWorld
String s3 = "123"+"Hello"+"World"; //123HelloWorld
String s4 = 1+"23HelloWorld"; //123HelloWorld
String s5 = 1+2+3+"HelloWorld"; //6HelloWorld
String s6 = 1+'2'+3+"HelloWorld"; //54HelloWorld
String s7 = "1"+2+"3HelloWorld"; //123HelloWorld
String s8_1 = "123";
String s8_2 = "HelloWorld";
String s8 = s8_1 + s8_2; //123HelloWorld
我知道的就这几种情况了,共同进步吧!
|