How do I fill arrays in Java?

后端 未结 8 1704
旧巷少年郎
旧巷少年郎 2020-11-27 14:09

I know how to do it normally, but I could swear that you could fill out out like a[0] = {0,0,0,0}; How do you do it that way? I did try Google, but I didn\'t get anything he

8条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-27 15:11

    Arrays.fill(). The method is overloaded for different data types, and there is even a variation that fills only a specified range of indices.

提交回复
热议问题