如何在java中使用(String [] [] args) [英] how to use (String [] [] args) in java
本文介绍了如何在java中使用(String [] [] args)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在java中使用(String [] [] args)和编写2d数组的程序。
how to use (String [] [] args) in java and write program of 2d array.
推荐答案
String [] []
是字符串数组的数组。有时这被称为二维数组。
String[][]
is an array of arrays of Strings. Sometimes that's called a two-dimensional array.
可以使用 X
的数组> new X [] {instanceOfX1,instanceOfX2,instanceOfX3} 。
An array of X
can be created using new X[] { instanceOfX1, instanceOfX2, instanceOfX3 }
.
由于 X
在这种情况下是 String []
你可以像这样创建一个 String [] []
:
Since X
in this case is String[]
you could create a String[][]
like this:
new String[][] { new String[] { "a", "b" }, new String[] { "x", "y" }, new String[] { } }
请注意,内部数组不需要具有相同的大小(这称为锯齿状数组)。
Note that the inner arrays don't need to be of the same size (this is called a jagged array).
这篇关于如何在java中使用(String [] [] args)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文