how to append to a string in java

Java
// Java program to illustrate the 
// StringBuilder append(boolean a) 
import java.lang.*; 
  
public class Geeks { 
  
    public static void main(String[] args) 
    { 
  
        StringBuilder sb1 = new 
                      StringBuilder("Welcome to Geeksforgeeks "); 
        System.out.println("Input: " + sb1); 
  
        // Appending the boolean value 
        sb1.append(true); 
        System.out.println("Output: " + sb1); 
  
        System.out.println(); 
  
        StringBuilder sb2 = new StringBuilder("We fail- "); 
        System.out.println("Input: " + sb2); 
  
        // Appending the boolean value 
        sb2.append(false); 
        System.out.println("Output: " + sb2); 
    } 
} 
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: