提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
创建多维数组并获取其维数
public class Main { /* from 时 代 J a v a - N o w J a v a . c o m */ static void f2D(double[][] tab) { System.out.println("Number of lines:" + tab.length); System.out.println("Number of columns:" + tab[0].length); } static void f3D(double[][][] tab) { System.out.println("Number of lines X:" + tab.length); System.out.println("Number of columns Y:" + tab[0].length); System.out.println("Number of depths Z:" + tab[0][0].length); } public static void main(String[] args) { double[][] var = new double[3][4];