Java

Program to concatenate a given string to the end of another string.

Program to concatenate a given string to the end of another string.
public class demo1 
{
    public static void main(String[] args)
    {
        String str1 = "Hello! ";
        String str2 = "How Are you.";
        
        System.out.println("String 1: " + str1);
        System.out.println("String 2: " + str2); 
               
        String str3 = str1.concat(str2);        
        System.out.println("The concatenated string: " + str3);
    }
}
Nikhil Juneja

Passionate software developer and technical contributor at TutorialsLink.