60 391
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #10495 in Java | JSP | JSF for Mike

Question #10495
Hello! How to initialize a two-dimensional array with particular values? Thanks!
Expert's answer
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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions