How to Concatenate String in Java


In this example we will show the method to concatenate string in Java.

Source Code

package com.beginner.examples;

public class ConcatenateString {
  public static void main(String args[]) {
    String str1 = "abc";
    String str2 = "def";
    System.out.println(str1 + str2); // concatenate string
  }
}

Output:

abcdef
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments