How can you increase the size of an array in Java?

  1. By using resize() method
  2. By reallocating with a new array
  3. Using array.grow()
  4. Using array.expand()
Correct answer By reallocating with a new array

Explanation

You must create a new array with a larger size and copy elements manually or using System.arraycopy().

Update: Admin added a tag on this question

Topics

By Admin · · 31 views