• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Passing arguments to method

 
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 everyone,
I thought the answer is sb1 is "HelloThere"; sb2 is "HelloThere",but is wrong.
Could anyone kindly explain to me.
Thanks a lot.
Vic

[I added UBB CODE tags to your source code to make it more readable. Please try to use them in the future - Ajith]

Answer is: sb1 is "HelloThere"; sb2 is "Hello".

[This message has been edited by Ajith Kallambella (edited September 05, 2000).]
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This question has been already asked & answered, within in the past week -- plz. refer to the previous questions.
 
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
When a method is called with parameters, the parameters is the copy of the real parameters. In the test, the refrence s1 and reference s2 is the copy of sb1 and sb2. Doublelessly, the first object is appended which is referenced by s1 and also by sb1. Though s2 is assigned with s1 in the method, the s2 really referencing the first object which appended, the sb2 still referencing the second object which has not been updated.
Did i expain it clear?
 
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
Thanks very much Shankar and Yiqing. I got it.
Vik
 
Hey cool! They got a blimp! But I have a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic