如何在 Java 中填充数组? [英] How do I fill arrays in Java?
本文介绍了如何在 Java 中填充数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道该怎么做,但我可以发誓你可以像 a[0] = {0,0,0,0}; 这样填写你是怎么做到的?我确实尝试过 Google,但没有得到任何帮助.
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 helpful.
推荐答案
您也可以将其作为声明的一部分进行:
You can also do it as part of the declaration:
int[] a = new int[] {0, 0, 0, 0};
这篇关于如何在 Java 中填充数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文