Thanks, but once the StringBuffer is having some data and I printed using
System.out, for the next time I have to rebuild the StringBuffer by eliminating
the previous content, what method I should use.
StringBuffer temp = new StringBuffer();
temp.append("test1");
temp.append("test2");
System.out.println(temp);
temp = new StringBuffer();
temp.append("test111");
temp.append("test222");
System.out.println(temp);

Is there any way, to directly overwrite the StringBuffer content with new
content.

Thanks in advance.

Sushil

[EMAIL PROTECTED] wrote:

> Hi,
>
> It shd be the following way:
>
> StringBuffer temp = new StringBuffer();
>
> temp.append("test1");
>
> temp.append("test2");
>
> System.out.println(temp);
>
> BFN
>
> Naga
>
> From: [EMAIL PROTECTED] on 21/11/2000 23:52 GMT
>
> Please respond to [EMAIL PROTECTED]
>
> To:   [EMAIL PROTECTED]
> cc:
> Subject:  StringBuffer Question
>
> Hi,
>
> I have a question regarding String and StringBuffer class. Recently I
> read that we should not use "+" concatenation since it will create
> temporary objects, instead we should use StringBuffer.  My JSP is
> producing series of System.out.println, like:
> .......
> some process
> ....
> System.out.println(new
> StringBuffer("test").append("test1").append("test2"));
> ----
> System.out.println(new
> StringBuffer("test3").append("test4").append("test5"));
> ----
> and so on.
>
> Now my question is that whether I should have one StringBuffer variable,
> append it and then displays or everytime "new StringBuffer".  Which way
> is the best, any feedback will be highly appreciated.
>
> Thanks in advance.
>
> Sushil
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to