Java program to Join two given strings
Following program shows you how to Join two given strings.
In this program we get strings from user and join those strings
import java.util.Scanner;
public class StringOperations3 {
public static void main(String[] args) {
String string1;
String string2;
Scanner in = new Scanner(System.in);
System.out.println("Please enter the first string:");
string1 = in.nextLine();
System.out.println("Please enter the second string:");
string2 = in.nextLine();
String output = string1 + string2;
System.out.println("Joined string is: " + output);
}
}
Output:
Please enter the first string:
hello
Please enter the second string:
world
Joined string is: helloworld