Java arrays change size

前端 未结 7 936
旧巷少年郎
旧巷少年郎 2020-12-10 09:02

I need to change the size of an array, but I cannot simply create another - It needs the same name so I can pass it to a method. Specifically, I need the array to have twice

7条回答
  •  心在旅途
    2020-12-10 09:57

    Yes, your array variable may reference an array of the same type but different size.

    For changing it internally, an ArrayList might be more easy to use.

提交回复
热议问题