top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

When an object is passed through a function, why one can set the properties but cannot set a new memory location?

+5 votes
464 views
When an object is passed through a function, why one can set the properties but cannot set a new memory location?
posted Sep 23, 2013 by Arvind Singh

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

It is bcoz when you pass an object the address value is passed & stored in some new address ,like if address 2435 is passed , it is stored in 6578 location. So if u change in the value of an object it will take the address from 6578 and do 2435.setXXX(). If you set the object to null it will set 6578=null.

answer Sep 23, 2013 by Vivek Singh
...