I read the k&B passing the variables and object.But land up with lots of doubts.Can any one please help me to understand the idea behing the pass by reference and pass by values.Is java using pass by values Or java using both.please give a good description
ranch(t1); .... ...} here also only one object is created and reference is sent to method ranch so whatever operation made in ranch method will reflect to original object.its also call by value but bit of confusing.
Tushar... Pune India
Sarath Koiloth Ramath
Joined: May 07, 2008
I think i got it.i will try to explain.
While passing a primitive variable ,Java is passing the copy of the variable.when we pass an object, the reference(that may be an address reference,but pointing to the same object) is passing.hence we say pass by value.So any change made will be reflected in the original object.I am correct...