Hello! How to initialize a two-dimensional array with particular values? Thanks!
1
2012-06-07T07:39:05-0400
public class q10495 {
public static void main(String args[]) {
int[][] numbers = {
{ 1, 2, 3, 4 },
{ 5, 6, 7, 8 }
};
for (int i = 0; i < 2; i++)
for (int j = 0; j < 4;
j++)
System.out.println("The element at [" + i + "][" + j + "]
is
" + numbers[i][j]);
}
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
JavaJSPJSF
Comments