Explain the following statement: Java is always pass-by-value.

Answers were Sorted based on User's Feedback



Explain the following statement: Java is always pass-by-value...

Answer / qamrun nisa

Other languages use pass-by-reference or pass-by-pointer.
But in Java no matter what type of argument you pass the
corresponding parameter (primitive variable or object
reference) will get a copy of that data, which is exactly
how pass-by-value (i.e. copy-by-value) works.

In Java, if a calling method passes a reference of an object
as an argument to the called method then the passedin
reference gets copied first and then passed to the called
method. Both the original reference that was passed-in and
the copied reference will be pointing to the same object. So
no matter which reference you use, you will be always
modifying the same original object, which is how the
pass-by-reference works as well.

Is This Answer Correct ?    15 Yes 2 No

Explain the following statement: Java is always pass-by-value...

Answer / nagababu

Pass by Value function receives a copy of variable. The
function or the method can not change variable values.

Is This Answer Correct ?    11 Yes 2 No

Explain the following statement: Java is always pass-by-value...

Answer / sitaram

The changes made in formal parameters will not reflect to
the actual parameters is called call-by-value. java is
supports to pass-by-value.

Is This Answer Correct ?    1 Yes 0 No

Explain the following statement: Java is always pass-by-value...

Answer / guest

yes java is always pass by value there is nothing pass by
reference in java
be sure while giving answer for this question
explain them with an example so that they can satisfied with
your answer

Is This Answer Correct ?    2 Yes 6 No

Post New Answer

More J2EE Interview Questions

What does j2ee stand for?

0 Answers  


What is the use of method saveorupdate()?

0 Answers  


Is java more difficult than c++?

0 Answers  


Is java still slow?

0 Answers  


What is a java applet?

0 Answers  






What is element?

0 Answers  


Is java a web technology?

0 Answers  


Which framework is best for java?

0 Answers  


What is 'applet container' ?

0 Answers  


for example we are login into the irctc server from there it will go to the selected bank and deduct amount and come back to the irctc. so if we are developing this in java means will it be run on the same session. but as per my knowledge bank is separate and irctc is separate URL's so it will use two different sessions then how it is maintaining same session through out application and even it uses the payment gateway? how it is working can any one help me on that??

0 Answers  


What is the difference between session bean and entity bean ?

0 Answers  


Is java good for web development?

1 Answers  


Categories