Write a Java program to concatenate two string

Introduction

In this demo I have used NetBeans IDE 8.2 for debugging purpose. But you can use any java programming language compiler as per your availability..

public class Javaexcercise {
 
    public static void main(String[] args)
    {
        String str1 = "Tech";
        String str2 = "Study";
 
        System.out.println("String 1: " + str1);
        System.out.println("String 2: " + str2); 
 
 
        // Concatenating the two strings together.
        String str3 = str1.concat(str2);
 
        System.out.println("The concatenated string: " + str3);
    }
}

Result

Write a Java program to concatenate two string
Write a Java program to concatenate two string

Leave a Comment

x