Java String Function concat

The java string concat() method combines specified string at the end of this string. It returns combined string. It is like appending another string.

Java String concat() method example

public class ConcatExample{  
public static void main(String args[]){  
String s1="java string";  
s1.concat("is immutable");  
s1=s1.concat(" is immutable so assign it explicitly");  


java string
java string is immutable so assign it explicitly