Link Details

There has been a good amount of debate on whether "Java is pass by value or pass by reference?". Well, lets conclude it last time, Java is pass by value and not pass by reference. If it had been pass by reference, we should have been able to C like swaping of objects, but we can't do that in java. We know it already, right? When you pass a instance to a method, its memory address are copied bit by bit to new reference variable, thus both pointing to same instance. But if you change the reference inside method, original reference will not get chnage. If it was pass by reference, then it would have got changed also.

Posted by lokeshgupta1981  |   Mar 08 2013 / 17:44

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Recommended Links

Scala
Written by: Ryan Knight
Featured Refcardz: Top Refcardz:
  1. Apache Hadoop
  2. Play
  3. Akka
  4. Debugging JavaScript
  5. Design Patterns
  1. Apache Hadoop
  2. REST
  3. Java
  4. Git
  5. Java Performance
Connect with DZone