Java Program to Append(Concatenate) one string to another
Java Program to concatenate or to append one string to another string in Java Programming, you have to ask to the user to enter the two string and start concatenating one string into the other using the concat() function.
In this program ,we are going to use in-built functions for appending one string to another.Below is the source code of the program u want……
SOURCE CODE ::
import java.util.Scanner; public class Append_string { public static void main(String args[]) { String str1, str2; Scanner scan = new Scanner(System.in); System.out.print("Enter First String : "); str1 = scan.nextLine(); System.out.print("Enter Second String : "); str2 = scan.nextLine(); System.out.print("Concatenating String 2 into String 1...\n"); str1 = str1.concat(str2); System.out.print("String 1 after Concatenation is " +str1); } }
OUTPUT ::
Enter First String : Codez Enter Second String : Club Concatenating String 2 into String 1... String 1 after Concatenation is CodezClub