Can we use simultaneously var-arg and 1-dimensional paramter in a method?

class VarArgMethod10
{
public static void main(String[] args)
{
int[] a={10,20,30};
int[] b={40,50,60};
m1(a,b);
}
public static void m1(int[]... x)
{
for(int[] i:x)
System.out.println(i[0]);
}
}
/*
Output:- 10 40
Explanation:- m1(int...x) => We can call this method by passing a group of int values and
"x" will become 1-dimensional array(int[] x).
m1(int[]...x) => But in this case, we can call this method by passing a group of
"1-D int arrays" and "x" will become 2-dimensional array(int[][] x).
*/

0 comments: