View RSS Feed

Parameter Passing

Parameter passing in Java

  1. Pass-by-reference vs Pass-by-value

    by , 01-08-2012 at 12:31 PM
    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. ...