Java OCA OCP Practice Question 1104

Question

Which of the following statements accurately describes how variables are passed to methods?

  • A. Arguments are always passed by value.
  • B. Arguments are always passed by reference.
  • C. Arguments that are primitive type are passed by value.
  • D. Arguments that are passed with the & operator are passed by reference.


C.

Note

Arguments are not always passed only by reference or only by value.

It depends on the argument itself, and primitives are always passed by value.

Java does not use the & operator to denote "pass by reference" as is done in the C programming language.




PreviousNext

Related