posted 23 years ago
Yes, Ananda , you are right
starting from left to right , java evaluate its expressions.
so, 1+2+"strange" will take the following steps:
1- take the first expression 1, and the second one , 2, then add them, giving 3
2- take 3, and the next expression which is a string, and add them, remember now this is not the arithmatic addition, this is the string concatenation +, becuase we have a string, so a new object is created with of type string and have the value "3strange"
if you follow the same logic ,the second statement should make sense.
hope this help