Answer to Question #47436 in Java | JSP | JSF for Zujaj

Question #47436
i need some help i need to initialize a 2d array named airplane of type int having values 0 and 1 only.row and column size is 12 and 7.How do i do it?
1
Expert's answer
2014-10-02T00:41:04-0400
int[][] airplane = new int[12][7];

for(int i=0; i<12; i++)
{
for(int j=0; j<7; j++)
{
if(i%2==0)
{
airplane[j]=1;
}
else
{
airplane[i][j]=0;
}
}
}
[i]

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 the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS