To make a TRUE copy of an array (not a reference copy):
- Acheck_circle
Both B and C work
- B
int[] b = Arrays.copyOf(a, a.length);
- C
int[] b = a;
- D
int[] b = a.clone();
Explanation
Both clone() and Arrays.copyOf produce independent copies.
AP Computer Science A· difficulty 4/5
To make a TRUE copy of an array (not a reference copy):
Both B and C work
int[] b = Arrays.copyOf(a, a.length);
int[] b = a;
int[] b = a.clone();
Explanation
Both clone() and Arrays.copyOf produce independent copies.
Want 10 more like this — adaptive to your weak spots?