String Concatenation

Java lets us concatenate strings together easily using the + operator. The example program uses this feature of the Java language to print its output. The following code snippet concatenates three strings together to produce its output:
“Input has ” + count + ” chars.”

Two of the strings concatenated together are literal strings: “Input has ” and ” chars.” The third string–the one in the middle–is actually an integer that first gets converted to a string and then is concatenated to the others.

Scroll to Top