Tuesday, September 8, 2015

Java pass by value vs pass by reference

Hi guys,

This blog is about pass by value and pass by reference concept and understanding. Primitives are always pass by value, objects are always pass by reference.

If only the fields of the parameter are modified in the called method , the changes will be reflected in the calling method . If the reference of the parameter is assigned to a new object , the change will not be reflected in calling method .

No comments:

Post a Comment

ec2-user@ec2 Permission denied