Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

StringBuffer

 
tony kanvas
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same question answered over here Marcus Green's JCHQ.NET Certification Discussion
 
tony kanvas
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Barry how we can make (b) take value of (a) thanks
 
Jose Botella
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tony, acting on the object pointed to by b, like this:

b.replace(0 , b.length() , a.toString());

Notice that b = a; did not work because within the method the parameter b acts like an alias of b such as b'; where b' = b had been executed at the time of the method invokation.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic