Object Reference Variable Aliasing
Develop code to declare variables to store reference types.
Consider this code segment that declares and initializes reference variables:
ArrayList<String> list1 = new ArrayList<String>();
ArrayList<String> list2 = new ArrayList<String>();
ArrayList<String> list3 = list1;
list1.add("Java");
list2.add("Python");
list3.add("C++");
After this code executes, what is the size of the ArrayList referenced by list1?
A
1
B
3
C
2
D
0
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | kaisuki | 1 | 2 | 0m 00s | 90 |
| #2 | ntgamja1 | 2 | 2 | 1m 50s | 90 |
| #3 | bommasam000 | 1 | 3 | 1m 15s | 5 |
| #4 | richa.tuli | 0 | 1 | 0m 13s | -23 |
| #5 | jaimonjosh | 0 | 1 | 1m 40s | -110 |
| #6 | lsj08030922 | 1 | 2 | 16m 26s | -896 |
Items per page:
10
1 – 6 of 6
APFIVE