Write a program to concatenate two string in java

Write a program to concatenate two string in java. Concatenation of strings with a Java program. As input, choose any two strings. We’ve created a function to which we input the two specified strings, and this function concatenates the strings using the concatenation operator, returning the desired result to the main function.

import java.util.Scanner;
public class Main
public static void main(String[] args)
String a, b, c;
Scanner s = new Scanner(System.in);
System.out.print("Enter first string");
a = s.nextLine();
System.out.print("Enter second string");
b = s.nextLine();
Main obj = new Main();
c = obj.concat(a, b);
System.out.println("New String"+c);
String concat(String x, String y)
String z;
z = x + " " + y;
return z;



Enter first string inlarn
Enter second string.com
New String inlarn .com