Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


Explain pass by reference and pass by value?

Answers were Sorted based on User's Feedback



Explain pass by reference and pass by value?..

Answer / vikas

Pass-by-value means, Passing a copy of the value.
Pass-by-reference means, instead of passing the actual
value, the address(of the value) is passed.

Is This Answer Correct ?    18 Yes 2 No

Explain pass by reference and pass by value?..

Answer / harsha

Passing the address itself rather than passing the value is
called ?Pass By Reference? and Passing a copy of the value
to be passed is called as ?Pass by Value?.

Is This Answer Correct ?    15 Yes 5 No

Explain pass by reference and pass by value?..

Answer / ganesh nagalingam

***In Java, primitives and object references are passed by
value.***
The variable represents the bit information which is copied
to the parameter.

eg:primitive****
Say for primitives x=2, the value of 2 is represented in
bits and it is copied to the parameter variable.

eg:object reference***
Button b = new Button("hello");
Button c = b;
Similarly for object reference the bit value in the
reference is copied to the parameter reference. Thus both
references have the same value representing an object. The
object reference(bit representation) represents a way to
get to the object.

Is This Answer Correct ?    8 Yes 1 No

Explain pass by reference and pass by value?..

Answer / srikanth doki

Passing the reference of the variable rather than passing
the value is known as Pass-by-reference and Passing the copy
of value is known as Pass-by-value.

Is This Answer Correct ?    3 Yes 1 No

Explain pass by reference and pass by value?..

Answer / aravind

Pass By Reference:
Passing the reference of the variable or object. In java
objects are passed by reference.

Pass By Value:
Passing the copy of the value. In java primitives are
passed by value.

Is This Answer Correct ?    2 Yes 1 No

Explain pass by reference and pass by value?..

Answer / mohammad faisal

In java when we declares a variable, at runtime it
initialize and allocated a memory space.
Change in the value of variable result in the change of
output.
Now,
In pass by value,
when a value is passed, the function creates its own
variable and assign it the passed value.
So any change made by that function will not change the
value of actual variable which is passed.

In pass by refernce,
instead of passing the value we pass the address of the
variable. In this case, the function does not allocate any
memory to its variable but the variable just point to the
passed variable. Any change made by the function result in
change the value of actual variable.

Is This Answer Correct ?    3 Yes 2 No

Explain pass by reference and pass by value?..

Answer / chinmay

passing the value instead of reference is known as pass by value,here primitive data should be given...
now pass by reference
Demo d=new Demo("abc");
Demo c=b;
here we pass the reference instead of value..
it is called pass by reference

Is This Answer Correct ?    1 Yes 0 No

Explain pass by reference and pass by value?..

Answer / dsr

The changes made in formal parameters will reflet to the
actual parameters.This is Known as pass by value.
The changes made in formal parameters will not reflet to
the actual parameters.This is Known as pass by reference.
java is completely pass by value.

Is This Answer Correct ?    1 Yes 9 No

Post New Answer



More Core Java Interview Questions

Explain the importance of finally block in java?

0 Answers  


If you are given the name of the function at run time how will you invoke the function?

0 Answers   Adobe, Yahoo,


Why does java have different data types for integers and floating-point values?

0 Answers  


What is the advantage of functional interface in java 8?

0 Answers  


What are the features of java?

0 Answers  






Write the code for Palindrome ?

2 Answers   Bally Technologies,


Explain why wait(), notify() and notifyall() methods are in object class rather than in the reading class?

0 Answers  


What modifiers are used for interface declaration?

7 Answers  


What is a boolean used for?

0 Answers  


why the equals method can be override?when we override the equals method?

5 Answers  


What is the use of 'super' keyword inside a constructor?

0 Answers   Flextronics, Thomson Reuters, Virtusa,


Can we overload final method in java?

0 Answers  






Categories