logo image

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);



Please enter the first string:
Please enter the second string:
Joined string is: helloworld