Java String Concat() Method

We always concatenate two string in java use the concat() method of String Class,the specific string parameter append to the given string when use the concat() method.

Syntax

Parameter

Return

A new string object.

Example of concatenate 2 string in java

output

What is the tdifference of concatenation by using concat() method and "+" connector

1、concat() method just can concatenation two string,but the "+" connector can use to concatenation more than 2 string.
2、the "+" connector can use to concatenation a string and objects that is not string type.