last exam we had the exercise to determine the output of the following code:
System.out.println(2 + 3 + \">=\" + 1 + 1);
My answer was <
Let's read it one token at a time from left to right:
The first literal encountered is an integer, 2, then a +, then another integer, 3. A + between two integers is addition, so they are added together to be 5.
Now we have 5, an integer, then a +, then a String ">=". A + between an integer and a String is a concatenation operator. So the Strings are combined to form "5>=".
Then we have "5>=", a String, a +, and then an integer, 1. This is String concatenation again. So the result is "5>=1".
Finally we have "5>=1", a String, a +, and the a 1. his is String concatenation again. So the result is "5>=11".