String concatenation in java.
The program demonstrates concatenation of two strings using string class
method concat().
The strings can also be concatenated using the "+" operator as shown.
/**************************************** * Concatenation of strings in Java * * code.cheraus.com *****************************************/ import java.util.Scanner; class str_concat { public static void main(String args[]) { Scanner str = new Scanner(System.in); System.out.print("Enter the first string : "); String s1 = str.nextLine(); System.out.print("Enter the Second string : "); String s2 = str.nextLine(); String s3 = s1.concat(s2); System.out.println(s3); } }