Question 6
Back to Exercise
Can you add a sixth element to an array created with new int[5]?
- A Yes, with add()
- B No – the size is fixed; create a larger array or use ArrayList Correct
- C Yes, by assigning a[5]
- D Only for String arrays
Correct Answer: Option B
Arrays.copyOf(a, 6) creates a new, larger copy.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!