utsav gupta wrote:thanks for all your suggestions.
Though I still wish there would have been a simple pass by value option for objects.
Sure that would be handy. The reason why Java doesn't allow it is the so called "slicing problem".
Slicing happens when an object of a certain type is copied to a variable of the supertype. Then the subtype part of the object is sliced off in the copying process. This is what would happen if an object could be passed by value to a method because this kind of parameter passing involves copying of the object.
So to avoid problems with slicing, Java handles all objects via references. References are never sliced when copied.