concat() String Example

concat() String Example

java.lang.String class comes with concat() String method to concatenate two strings.

The signature is given as defined in String class.

  • public String concat(String str): Returns a new string, the result of concatenation of two strings.

Following example concat() String illustrates the usage concat() method.

concat() String
Output screenshot on concat() String Example

By performance concat() is nearly 40 times faster than using + operator.

Pass your comments and suggestions on this tutorial "concat() String Example".

Leave a Reply

Your email address will not be published. Required fields are marked *