This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
in terms of diagram we can have like this
System.out.println("in append method");//insert this line will make it more clear
System.out.println(sb1 + "," + sb2);
prints bb,bb(because value for duplicates is getting printed pattern)
but in original it will prints sb1=ab and sb2=bb..