• This is a String expression, using the string concatenation operator, +.
  • The concatenation of 2 Strings is meant to be analogous to the addition of 2 numbers, hence the use of the same operator: +.
  • However, num1 and num2 are not Strings! They are of type int.
  • When the Java compiler sees an expression using the + operator, where at least 1 of its 2 operands is a String, it converts the other operand (in this case, an int) to its String representation.
  • In general, mixing types in an expression can be dangerously unclear.
  • In this case the expression is simpler than:

    Integer.toString( num1 ) + " == " + Integer.toString( num2 )