# pass-by-value you are using copy of variable (in method) changes to this copy doesn't affect original variable in case of reference type: using "." for member access is not considered as change to variable, it is change to referenced object (be careful here).
# pass-by-reference variable passed by reference doesn't create copy of original variable, it creates alias, which reflects changes to original value you don't need to worry with pass-by-reference in Java, everything is passed by value
Hi, What John says is exactly the answer you need. But i'll also like to add in that in Java even object references are passed by value. The behaviour then seems a bit confusing(atleast i was confused a lot in the begining) but with proper explanation, things will become crystal clear.
I am a beginner to scjp...but I did a lot of c and c++ before this .the fundamental of passing variables is same in any object oriented language So 1)in Pass by Value a copy of orignal parameters are available to the called method So operations performed on the formal parameters does not reflect back to the orignal values. Take it like this: This method uses a Photo Stat
2)in Pass by Refrence, the refrence of the orignal parameters are passed to the called method so all the operations done reflects back to the orignal parameters and this uses the orignal documents
well this was all defination stuff when you pass the actual parameter of primitive data type it is passing by value. and when you pass the actual parameter as refrence to an object ,it is pass by refrence.I think that will be all
So what I understand from you guys is Pass By Reference means the passing the address itself rather than passing the value. Passby Value means passing a copy of the value to be passed. Java only use Pass by Value!!
hi, pass by value: passing a copy of original value.in calling method a new local variable is created and assigned the copy of value.and its scope is with in that method only i.e calling method cannot change original value. pass by reference: passing a copy of reference of object or variable that is the calling method creates a new reference to the original object or variable that is any changes made in it that calling method also changes original value