/******************************************************************************
 * Example of Strings
 ******************************************************************************/

public class string1
{
    public static void main (String[] args) 
    {
        String name;                                    //declare a string
        name = "Sam Sultan";                            //assign to a string

        String greeting = "Hello";                      //declare and initialize

        String question = new String("How are you?");   //the more formal way        
        String salutation;
        String anotherStr;

        salutation = greeting + " " + name;                     //append or concatenate

        System.out.println(salutation); 

        salutation += " " + question;                           //append to end of string
        System.out.println(salutation); 

        salutation.toUpperCase( );                              //Change to uppercase
        System.out.println(salutation + " It didn't work"); 

        anotherStr = salutation.toUpperCase( );                 //Change to upcase & assign to another variable     
        System.out.println(anotherStr + " Now it works"); 

        salutation = salutation.toUpperCase( );                 //change to upcase & reassign to same variable     
        System.out.println(salutation + " Using the same variable name"); 
    }
}