aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes String buffer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "String buffer" Watch "String buffer" New topic
Author

String buffer

Archana Agrawal
Greenhorn

Joined: May 14, 2002
Posts: 23
hello all,

public class TestBuffer {
public void myBuf( StringBuffer s, StringBuffer s1) {
s.append(" how are you") ;
s = s1;
System.out.println("s in mybuf block is " +s);
}
public static void main ( String args[] ) {
TestBuffer tb = new TestBuffer();
StringBuffer s = new StringBuffer("Hello");
StringBuffer s1 = new StringBuffer("doing");
tb.myBuf(s, s1);
System.out.print("s is main block is : " +s);
}
}
The output is:-
s in mybuf block is doing.
s is main block is : Hello how are you.
So now, my question is that in mybuf method the value of s is changed to doing,then how i am getting the output as "Hello how are you" in main block,
please help,
thanks in advance.........
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: String buffer