whenever i am passing two 1-d array as argument to a 2-d array it is working fine, but when i try to pass three 1-d arrays to a 3-d array argument method then it is giving error but same works fine when i pass three 1-d array to 2-d array.
What is the reason behined this behaviour ?
Two 1-d array to a 2-d method:-
int[] c=new int[] {4,50};
m1(new int[]{10,20},c);
public static void m1(int[]... a)]
Three 1-d array to a 3-d method :- , error - The method m1(int[][]...) in the type Asd is not applicable for the arguments (int[], int[], int[])
int[] b=new int[] {3,50};
int[] c=new int[] {4,50};
m1(new int[]{10,20},c,new int[] {4,50});
public static void m1(int[][]... a)
Three 1-d array to 2-d array:-
int[] c=new int[] {4,50};
m1(new int[]{10,20},c,new int[] {4,50});
}
public static void m1(int[]... a)
int[][]... aexpects 2d arrays, but you are passing 1d arrays. How do think this should work? Where 1d array should be placed inawhich is 3d array?[x][y][z]but if array is{ {1, 2}, {3} }then what should be result fora[0][0][0]? If that would be possiblea[0]would return{1}, thena[0][0]would return1but thena[0][0][0]would be like calling1[0]which doesn't make sense since1is not an array.