5 Replies Latest reply on Oct 16, 2007 9:54 AM by 807600

    some confusion related to stringbuffer

    807600
      Hi
      They say that String is not immutable and StringBuffer is...however when i wrote a piece of code, i found that i can change the contents of String..
       Scanner user_in = new Scanner (System.in);
              String input = user_in.nextLine();
              input=input.toLowerCase();
              System.out.println(input);
      Here I was able to change the contents of String input... what went wrong ? Is String not supposed to be immutable ??? If so why I was able to change its contents to lowercase ??