'pass by value' and 'pass by reference'
Hi all,
I have one doubt in java that is
what is 'pass by value' and 'pass by reference' ?
how both use in java..
Re: 'pass by value' and 'pass by reference'
Re: 'pass by value' and 'pass by reference'
Tanx For ur replay . if u have the gmail please add me to ur gtalk list . lets be in contact
Re: 'pass by value' and 'pass by reference'
Re: 'pass by value' and 'pass by reference'
ok i am confused...
what about arrays?
if:
int i[] = {1};
and i pass it to a method and the method changes it, the actual array is changed. so after the initial change in a method, if that method exits and another method calls the same array, what is stored in the array is what the previous method changed it to, not the original. I was always told that that was passing by reference, help please.
thanks
Re: 'pass by value' and 'pass by reference'
Quote:
Originally Posted by
that_guy
ok i am confused...
what about arrays?
if:
int i[] = {1};
and i pass it to a method and the method changes it, the actual array is changed. so after the initial change in a method, if that method exits and another method calls the same array, what is stored in the array is what the previous method changed it to, not the original. I was always told that that was passing by reference, help please.
thanks
Did you read the tutorials you were given? Basically, the thing that's being passed by value is a reference to the array. The tutorials explain it quite well, so I won't go into it further here.