Java String concat() with examples
The Java String concat() method concatenates one string to the end of another string. This method returns a string with the value of the string passed into the method, appended to the end of the string. Consider the below illustration:
Input: String 1 : abc String 2 : def String n-1 : ... String n : xyz Output: abcdef...xyz
public String concat(String anostr)
Parameter: A string to be concatenated at the end of the other string
Return: Concatenated(combined) string
As perceived from the code we can do as many times as we want to concatenate strings bypassing older strings with new strings to be contaminated as a parameter and storing the resultant string in String datatype.