In this article, we will introduce how to use the length property of the array to get the length of the array.
In the following example, we define a two-dimensional array and obtain the length of the array:
/* author by w3cschool.cc 文件名:Main.java */public class Main { public static void main(String args[]) { String[][] data = new String[2][5]; System.out.println("第一维数组长度: " + data.length); System.out.println("第二维数组长度: " + data[0].length); }}
The output result of running the above code is:
第一维数组长度: 2 第二维数组长度: 5
The above is the Java example-getting the array The length of the content, please pay attention to the PHP Chinese website (www.php.cn) for more related content!