Explain the following statement: Java is always pass-by-value.
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
What should a junior java developer know?
Is java 100 percent pure object oriented?
Every field has setter and getter methods.what is happening in this methods.
What is asant?
What is a java application server?
Why java is oop language?
public class ActionSearchBean extends GenericSearchBean<ActionDTO, Long, ActionDTO> { @Override public String search() { data.setRowCount(null); if(data.getRowCount()==0){ data.getNoRecordFound().setRendered(true); data.getDataScroller().setRendered(false); } return "searchAction"; } @Override public String clear() { data.setRowCount(null); if (data.getRowCount() > 0){ data.getNoRecordFound().setRendered(false); data.getDataScroller().setRendered(true); }else{ data.getNoRecordFound().setRendered(true); data.getDataScroller().setRendered(false); } data.setModel(new ActionDTO()); data.setRowCount(null); return "searchAction"; } } what is the purpose of @Override ...what will do @Override here ?
What is ebxml?
What is java developer job description?
What is java api for xml-based rpc (jax-rpc)?
What is advance java?
What are the different java technologies?