srinivas saitala

Greenhorn
+ Follow
since May 01, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by srinivas saitala

class MWC205 {

public void m1(StringBuffer s1) {
s1.append("B");
System.out.println("One :"+s1);
}

public void m2(StringBuffer s1) {
s1 = new StringBuffer("C");
System.out.println("Two : "+s1);
}

public void m3(StringBuffer s1) {
System.out.println("min One "+s1);
}


public static void main(String[] s) {
StringBuffer s1 = new StringBuffer("A");
new MWC205().m1(s1);

new MWC205().m2(s1);

new MWC205().m3(s1);
System.out.print("Three "+s1);
}
}

Could anyone please explain me in detail, why the output of "Three" is AB instead of C.
17 years ago