I know its a silly question but I want to know that Is it possible to find the array dimension? when we have the following code
public class ArrayDimentionCheck {
public static void main(String[] args) {
Integer[][] arr = { { 1, 2 }, { 2, 3 } };
printDimension(arr);
Integer[][] arr1 = { { 1, 2, 4 }, { 2, 3, 6 } };
printDimension(arr1);
}
private static void printDimension(Object arr) {
System.out.println("given object dimension:");
}
}
Can we write some generic code in printDimension method to identify the array dimension??