Is Java pass by value or pass by reference?

C++ programming question (pass by value/ reference)?

  • If i want a funcion's parameter to never alter the runtime value passed by the caller program should i use pass by value or pass by reference parameter? thank you

  • Answer:

    The answer they are looking for here is pass by value, but it's a bad question, because you can pass by const reference too, which would also achieve the same thing.

yoo9189 at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

when you pass by value you are passing the value that is stored at some memory location. When you pass by reference you are passing, in effect, the memory address of the container that stores the value (be it an array, structure, variable etc.) Now that you know this what do you think the correct answer is?

You can pass by value or pass a constant reference. Either will work. http://xoax.net/comp/cpp/console/Lesson18.php

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.