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 == list3)
C
(list1 == list2)
D
(list1.get(0) == list2.get(0))
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | y.seong2027 | 3 | 3 | 1m 03s | 237 |
| #2 | barkern195 | 1 | 1 | 1m 01s | 39 |
| #3 | busemagngr | 1 | 3 | 1m 26s | -6 |
Items per page:
10
1 – 3 of 3
