Java Program to Concatenate Two Strings

You are currently viewing Java Program to Concatenate Two Strings

Java program to concatenate two strings

import java.util.Scanner;

public class StringConcatenation 
	public static void main(String args[])
	{   // creating object of the string s1,s2.
		String s1,s2;
		Scanner sc=new Scanner(;
		// enter both the string one by one.
		System.out.print("Enter First String : ");
		System.out.print("Enter Second String : ");
		// here we print the whole string after concatenation.
		System.out.println("String After Concatenation : " +s1.concat(s2));


First run:
Enter First String : Include
Enter Second String : Help
String After Concatenation :IncludeHelp

Second run:
Enter First String : Java
Enter Second String : Programming
String After Concatenation : JavaProgramming


Hi, I'm Manoj a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply