Java OCA OCP Practice Question 1160

Question

Fill in the blank:

Java uses ____ to send data into a method.

  • A. pass-by-null
  • B. pass-by-value
  • C. both pass-by-value and pass-by-reference
  • D. pass-by-reference


B.

Note

Java uses pass-by-value to copy primitives and references of objects into a method.

The changes to the primitive value or reference in the method are not carried to the calling method.

The data within an object can change, just not the original reference itself.

Option B is the correct answer.

Options C and D are incorrect.

Option A is not a real term.




PreviousNext

Related