Given a variable A that contains a reference to an object of type MyClass, which
ID: 3527625 • Letter: G
Question
Given a variable A that contains a reference to an object of type MyClass, which of the following best describes the effect of the code below? MyClass B = A; (A) It sets an existing variable B to contain a refrence to the same object as A (B) It sets an existing variable A to contain a refrence to the same object as B (C) It creates and initialises a variable A to contain a reference to the same object as B (D) It creates and initialises a variable B to contain a reference to the same object as A (E) It returns true if A and A refer to the same object. What I think: D because MyClass B = A is just like String B = AExplanation / Answer
Yes.
It creates and initialises a variable B to contain a reference to the same object as A