raj talatam wrote:
can any please tell me whether java uses pass value, or pass by reference , in complete reference it is written that it uses both ,but in many blogs i have read it uses only pass by value
in complete reference
Ivan Jozsef Balazs wrote:
in complete reference
Which reference?
raj talatam wrote:
if java passes variables by value , then it should print 20, 10 .
but it is printing 20,20;
Actually what is happening ???
raj talatam wrote:if java passes variables by value , then it should print 20, 10 .
Jesper de Jong wrote:
raj talatam wrote:if java passes variables by value , then it should print 20, 10 .
No, your example doesn't have anything to do with pass-by-value or pass-by-reference. Pass-by-value or pass-by-reference are concepts that have to do with how arguments to a method are passed. In your example, you're not calling any methods, so the example says nothing about whether arguments are passed by value or by reference to a method.
See the JavaRanch Campfire Story: Pass-by-Value Please, which explains the concept in detail.
raj talatam wrote:in that example i am assigning same object COne to xyz also right, if java passes by value , the Actual value of var1 has to be print right.
raj talatam wrote:in that example i am assigning same object COne to xyz also right, if java passes by value , the Actual value of var1 has to be print right.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Consider Paul's rocket mass heater. |