How do I fill arrays in Java?

后端 未结 8 1710
旧巷少年郎
旧巷少年郎 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 14:50

    You can also do it as part of the declaration:

    int[] a = new int[] {0, 0, 0, 0};
    

提交回复
热议问题