|
Examine the above. Is the following code correct? String first = "Kublai" ; String last = " Khan" ; String name = first.concat( last ); A good answer might be:Yes. | |
The concat() MethodThe parts of the statement match the documentation correctly:
The concat method performs string concatenation. This is constructing a new String by using the data in two other Strings. In the example, the first two strings (referenced by first and last) supply the data that concat uses to construct a third string (referenced by name.)
String first = "Kublai" ; String last = " Khan" ; String name = first.concat( last ); The first two Strings are NOT changed by the action of concat. A new string is constructed that contains the results of the action we wanted. | |
QUESTION 8:(Review:) Have you seen string concatenation before? Click Here after you have answered the question |