February 2014
Beginner
1248 pages
62h 25m
English
Java allows you to assemble String objects into larger strings by using operators + or +=. This is known as string concatenation. When both operands of operator + are String objects, operator + creates a new String object in which the characters of the right operand are placed at the end of those in the left operand—e.g., the expression "hello " + "there" creates the String "hello there".
In line 24 of Fig. 6.3, the expression "Maximum is: " + result uses operator + with operands of types String and double. Every primitive value and object in Java can be represented as a String. When one of the + operator’s operands is a String, the other is converted to a String, then the two are concatenated. In ...
Read now
Unlock full access