Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

public class Main {
    public static void main(String args[]) {
        String[][] data = new String[3][4];
        System.out.println(getDimension(data));
    }

    public static int getDimension(Object array) {
        int dim = 0;
        Class c = array.getClass();
        while (c.isArray()) {
            c = c.getComponentType();
            dim++;
        }
        return (dim);
    }
}
//2