I have seen people getting confused with this. Just to make clear – Java always pass by value and not by reference.

Now comes the confusing part. If Java pass by value, then how come the value of properties in objects get changed. Well, the reference of object is passed as parameter.

Advertisements