Multiple choice

Which of the following statements is/are true?

i. Primitive data types are passed by value. ii. Java only supports pass by value. iii. Java only supports pass by reference. iv. Primitive data types are passed by reference.

  1. Both i and iii. are true

  2. Both ii. and iv. are true

  3. Both i. and ii. are true

  4. Both iii. and iv. are true

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

This answer is correct. Java only supports pass by value not pass by reference. The primitive data types are passed by value. Also, since no object defined for primitive types, primitive data types are passed only by value.