Question 78Asked in UGC NET Computer Science, June 2016 (Paper II & III, Selected Questions)

When one object reference variable is assigned to another object reference variable then

  1. AA copy of the object is created
  2. BA copy of the reference is created
  3. CA copy of the reference is not created
  4. DIt is illegal to assign one object reference variable to another object reference variable
Show answerHide answer

Correct answer: (B) A copy of the reference is created

Explanation

Assigning one object reference variable to another copies only the reference (address), not the object. Both variables then refer to the same object; no distinct copy of the object is created. So a copy of the reference is created.

From UGC NET Computer Science PYQ, June 2016 (Paper II & III, Selected Questions)

This is question 78 of UGC NET Computer Science PYQ, June 2016 (Paper II & III, Selected Questions). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.