public class StringTest2 {

/* Help on immutable String
http://stackoverflow.com/questions/8798403/string-is-immutable-what-exactly-is-the-meaning
*/

   public static void main (String [] args) {
      String s = "some text";
      s = s.substring(0,4);
      System.out.println(s); // still printing "some text"
      String a = s.substring(0,4);
      System.out.println(a); // prints "some"
      
      String s1 = "java";
      s1.concat(" rules");
      System.out.println("s1 refers to: "+s1);  // Yes, s1 still refers to "java"
      s1 = s1 + " RULES";
      System.out.println("after +RULES s1 refers to: " + s1);
   }
}