java concatenate strings

Java
public class Concat {
    String cat(String a, String b) {
        a += b;
        return a;
    }
}String firstName = "BarackObama";
String lastName = " Care";
//First way
System.out.println(firstName + lastName);
//Second way
String name = firstName + lastName;
System.out.println(name);
//Third way
System.out.println("BarackObama" + " Care");class Main
{
	public static void main(String args[])
    {
		String myString = "";
      	for (int i = 0; i < 3; i++)
        {
        	myString += "Hello There "; 
        }
      	System.out.println(myString); // Hello There Hello There Hello There 
    }
}
Source

Also in Java: