Data Type Java Tutorial

You can compose long string literals by using the plus sign to concatenate two string literals.

public class MainClass {
  public static void main(String[] a) {
    String s1 = "1 " + "2";
    String s2 = s1 + " = 3";
    System.out.println(s1);
    System.out.println(s2);
  }
}
1 2
1 2 = 3