LearnFrenzy
Sign in Take a free test

Arrays in Java · Java Arrays MCQ · Question 6

Can an array grow? Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
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!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links