0
It dawned on me! #2
Do you know the result of these examples? Example #1: System.out.println("1" + 2 + 3); Example #2: System.out.println(1 + 2 + "3"). The thing is thst the "+" operator in Example #1 means "string concatenate", not "add". That's why, the result of Example #1 is "123". Let's see the second Example. The "1" is found with no left context, so it is just an integer. The following "+" is found with left context integer, so it is interpreted as a real add operator, thus (1+2) gives 3. That result is found with left context of "+", so it is coerced to a string and concatenated to produce "33". The following examples in code: https://code.sololearn.com/cKc8KXLXBOME/#java
1 ответ
+ 5
yes, this kind of questions is often in C# and Java challenges, thanks for sharing 😃 👍