+ 3
Why are objects passed by reference (not value)?
2 odpowiedzi
+ 3
Minimizing memory consumption and CPU time in recreating and doing a deep copy of every object passed somewhere.
http://programmers.stackexchange.com/questions/57068/why-are-objects-passed-by-reference
+ 2
Because in Java all objects declared and used are essentially pointers. By doing so no unnecessary additional objects are created, and therefore memory allocation is more efficient. If you want to create an exact copy of an object, you should use the clone() method.