hi,
what is the output?
1)public class RefTest {
public static void main(
String [] args) {
String a = "first";
StringBuffer b = new StringBuffer("second"); manipulate(a,b);
System.out.println("a = " + a + ", b = " + b );
}
static void manipulate(String x, StringBuffer y) { String temp = x;
x = y.toString();
y.append(":xtra");
y = new StringBuffer(temp);
}
}
2)public class TestBuffer {
public void myBuf(StringBuffer s, StringBuffer s1) {
s.append(" how are you");
s = s1;
}
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);
}
}