Maybe you are looking for something like this:
public class Test {
public static void main(String[] args) {
int []x[]={{1,2},{3,4,5},{6,7,8,9}};
for(int i=0; i<x.length; i++) {
for(int j=0; j<x[i].length; j++) {
System.out.println("x["+i+"]["+j+"]= " + x[i][j]);
}
}
}
}
the output is:
x[0][0]= 1
x[0][1]= 2
x[1][0]= 3
x[1][1]= 4
x[1][2]= 5
x[2][0]= 6
x[2][1]= 7
x[2][2]= 8
x[2][3]= 9
1
solved Representation of Array program in java [duplicate]