Friday, April 5, 2019

string concatenation

string concatenation                                                                                edited by diya


import java.util.Scanner;
class p19
{
public static void main(String args[])
{
Scanner n=new Scanner(System.in);

System.out.println("Enter a string");
String s1=n.nextLine();
System.out.println("Enter a string");
String s2=n.nextLine();
s1=s1.concat(s2);
System.out.println("after concatenation");
System.out.println(s1);

}

}


D:\>javac p19.java

D:\>java p19
Enter a string
dil
Enter a string
diya
after concatenation
dildiya

D:\>

No comments:

Post a Comment