I am learning about StringBuffer and have two questions:
[1] I tried creating a new String using StringBuffer, initialize it and specify it's length using the following statement:
StringBuffer s=new StringBuffer("Hi Gisela".length());
However when I do System.out.println(s); it does not display anything. Why? Where did "HI Gïsela" go?
[2] I understand that StringBuffer allows the program to edit its contents.
If I have StringBuffer s1=new SringBuffer("Hello");
how do I change the String to "Bye"?
[1] I tried creating a new String using StringBuffer, initialize it and specify it's length using the following statement:
StringBuffer s=new StringBuffer("Hi Gisela".length());
However when I do System.out.println(s); it does not display anything. Why? Where did "HI Gïsela" go?
[2] I understand that StringBuffer allows the program to edit its contents.
If I have StringBuffer s1=new SringBuffer("Hello");
how do I change the String to "Bye"?