Difference between call by value and call by reference in Java

Submitted 6 months, 3 weeks ago
Ticket #363
Views 114
Language Java
Priority Low
Status Closed

Can I know the exact difference between them and when should we use them ....

Thanks in advance.....

Submitted on Feb 28, 21
add a comment

1 Answer

Verified

In Java, all argument values are passed to a method using only call by value (pass by value) mechanism.

There is no call by reference (pass by reference) mechanism in Java.

  “Call by value” in Java means that argument’s value is copied and is passed to the parameter list of a method.

That is, when we call a method with passing argument values to the parameter list, these argument values are copied into the small portion of memory and a copy of each value is passed to the parameters of the called method.

Submitted 6 months, 3 weeks ago


Wanna Post Ad?
Reach a large group of audience by posting an ad about your business here. For more details
Drop us a Message