Java supports pass by value or reference?

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.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s