Wednesday 13 May 2015

Concatenate the string in java

package strg;

import java.util.Scanner;

public class concatestrng {


public static void main(String[] args) {
String a=null,b=null,c;
Scanner sc =new Scanner(System.in);
System.out.println("Enter the first string");
a=sc.nextLine();
System.out.println("Enter the second string");
b=sc.nextLine();
c=a.concat(b);
System.out.println("String is: "+c);



}

}

No comments:

Post a Comment