| preferred AP College board partner for AP classes
AP Computer Science A/Unit 4: Iteration
Start Practice Test
Share
medium Solved by 1 students
Object Reference Comparison
< Prev
Next >

Consider the following code segment. Which of the Boolean expressions will evaluate to true after the segment has been executed?

ArrayList<String> list1 = new ArrayList<String>();
ArrayList<String> list2 = new ArrayList<String>();
ArrayList<String> list3 = list1;

list1.add("apple");
list2.add(new String("apple"));
A

(list2 == list3)

B

(list1.get(0) == list2.get(0))

C

(list1 == list3)

D

(list1 == list2)

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer

Question Leaderboard

Not enough data yet to show leaderboard.

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy