I\'m new to Java. What does the below mean?
(addition) + sign in println
System.out.println ("Count is: " + i);
In that context, the +
operator is acting as the string concatenation operator. It acts as a different operator in the context of two integral types, where addition will be performed.
Assuming i
is an integral type, it'll be converted to a String
and then added on to the end of a new string beginning with "Count is: "
. That new string is then printed.
ie. If i
had the value 0
, it'd be the same as:
"Count is: " + "0"
Which would be:
"Count is: 0"