Check out example codes for "how to add strings in java". It will help you in understanding the concepts better.

Code Example 1

String firstName = "BarackObama";
String lastName = " Care";
//First way
System.out.println(firstName + lastName);
//Second way
String name = firstName + lastName;
//Third way
System.out.println("BarackObama" + " Care");

Code Example 2

public class Concat {
    String cat(String a, String b) {
        a += b;
        return a;

Learn ReactJs, React Native from