top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is Java “Pass by Value” and “Pass by Reference” ?

+2 votes
350 views
What is Java “Pass by Value” and “Pass by Reference” ?
posted Dec 22, 2014 by Dominic

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

Java uses “Pass By Value” when arguments are passed to a method. The value of the original variable cannot be changed within the method.

When an object is passed as an argument to a method, actually original objects reference is passed. This is called "Pass by reference". Any change in the attribute of an objects results in changing the original object itself.

answer Dec 24, 2014 by Karthick.c
...