import java.util.Scanner;

public class StringConcatenation {

public static void main(String[] args) {

// Create a Scanner object to read input from the user

Scanner scanner = new Scanner(;

// Prompt the user to enter the first string

System.out.print("Enter the first string: ");

String firstString = scanner.nextLine();

// Prompt the user to enter the second string

System.out.print("Enter the second string: ");

String secondString = scanner.nextLine();

// Concatenate the two strings

String concatenatedString = firstString + secondString;

// Display the concatenated string

System.out.println("Concatenated string: " + concatenatedString);

// Close the scanner





This program first prompts the user to enter two strings, then it concatenates them using the `+` operator, and finally, it prints out the concatenated string.