Object Reference Comparison
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)
Question Leaderboard
Not enough data yet to show leaderboard.
APFIVE