/**
 * Demonstrates string concatenation, construction of strings, several methods of the 
 * String class, escape characters, and Unicode.
 *
 * @author Drue Coles
 */
public class StringDemo {

    public static void main(String[] args) {
        
        System.out.println(5 + 7); 
        System.out.println("5 + 7");  
        
        // concatenating strings
        System.out.println("5" + "7");  
        System.out.println("5" + 7); 
        
        // strings are immutable
        String str = "quokka";
        System.out.println(str); 
        System.out.println(str.toUpperCase());
        System.out.println(str); 

        // changing a reference to a string, not the string itself
        str = str.toUpperCase();    
        System.out.println(str);    

        // more string methods
        str = "Your powers are weak, old man."; 
        System.out.println(str.replace("p", "fl"));
        int k = str.indexOf(",");
        String t = str.toUpperCase().substring(1, k) + "!";
        System.out.println(t);  

        // escape characters
        System.out.println("*\n**\n***"); 
        System.out.println("T\tA\tB");         
        System.out.println("She said, \"Attack!\"");   
        System.out.println("This is a backslash: \\"); 
        
        // Unicode
        System.out.println("\u03c6 \u014e \u21aa \u2665 \u2600 \u2714 \u2317"); 
    }
}