View RSS Feed

Java Basic

Pass-by-reference vs Pass-by-value

Rate this Entry
by , 01-08-2012 at 11:31 AM (2371 Views)
In other languages like C++ you can pass a value by reference or by pointer. In Java when you pass a parameter, the receiving object always gets a copy of the passed parameter. It is also known as pass by value concept. To pass a reference of an object in java as an argument, the passed in object is first copied and then passed to other method. In such cases both will be pointing to same object in memory. Also in this case, you will be modifying the original object for which a reference is passed.

Name:  55.JPG
Views: 656
Size:  31.7 KB

Pass-by-reference vs Pass-by-value

You call a method in another JVM, and then calling method has a different address space as compared to called method. It is also called inter process communication and performance is affected by marshalling and unmarshalling of objects.

Submit "Pass-by-reference vs Pass-by-value" to Facebook Submit "Pass-by-reference vs Pass-by-value" to Digg Submit "Pass-by-reference vs Pass-by-value" to del.icio.us Submit "Pass-by-reference vs Pass-by-value" to StumbleUpon Submit "Pass-by-reference vs Pass-by-value" to Google

Comments