Home » java » Java String concat() method

Java String concat() method

String concat() is used to concatenate two strings. The parameter str string is appended to specified string and new string object is returned by this method.
Example
“Hello ”.concat(“Friends”)
This will generate a new string object “Hello Friends”

Parameters

Str – is string parameter used to concatenate with specified string

Example

Here str is concatenated with ” ” then it is concatenated with str1 and result is assigned to str3 String object.

Please follow and like us:
error