• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

don't understand

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

hi, there
could you explain to me in detail the outcome of following code(i am pretty new to java)?
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
fengqiao
This question was asked just last week here at this thread. If you have any let us know and we'll help you out.

------------------
Dave
Sun Certified Programmer for the Java� 2 Platform
 
fengqiao cao
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dave
thanks a lot. Finally, i got it. ( method append()change the object itself, but reference assignment just provide a handler to an object, the object itself not being affected at all.)
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Food for thought...What if your objects were of type String instead of its peer StringBuffer?...This piece of code might help.

Hope this helps
Shyam
 
fengqiao cao
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Shyamsundar
i have difficulty on understanding of the first output. could you explain to me? The secod is "doing" and third one is "hello"( string is immutable).

thank you very much.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I've invoked my artistic abilities... ...Do tell me if you need further explanation.

Hope this helps
Shyam

[This message has been edited by Shyamsundar Gururaj (edited October 29, 2001).]
 
reply
    Bookmark Topic Watch Topic
  • New Topic