Java passes everything by value, and not by reference.
When passing an argument (or even multiple arguments) to a method, Java will create a copy and pass that to the method as arguments – and that is why it is called pass by value.
a variable of a class type stores an address of the object, and not the object itself.
Java manipulates objects 'by reference,' but it passes object references to methods 'by value.'
Also refer to http://www.javaranch.com/campfire/StoryPassBy.jsp
http://architects.dzone.com/articles/java-pass-value-and-not-pass-0
Read full article from Does Java pass by reference or by value?
When passing an argument (or even multiple arguments) to a method, Java will create a copy and pass that to the method as arguments – and that is why it is called pass by value.
a variable of a class type stores an address of the object, and not the object itself.
Java manipulates objects 'by reference,' but it passes object references to methods 'by value.'
Also refer to http://www.javaranch.com/campfire/StoryPassBy.jsp
http://architects.dzone.com/articles/java-pass-value-and-not-pass-0
Read full article from Does Java pass by reference or by value?
No comments:
Post a Comment