Don't know if you care (this post is pretty old), but your code is incorrect. The correct version of main is:
public static void main(String args[]) {
int twoDm[][]= new int[4][5];
int i,j,k=0;
for(i=0;i<4;i++)
for(j=0;j<5;j++) {
twoDm[i][j]=k;
k++;
}
for(i=0;i<4;i++){
for(j=0;j<5;j++)
System.out.print(twoDm[i][j]+" ");
System.out.println();
}
}
javamaharani July 5, 2012 at 8:19 PM
multidimensional array using student marklist program.
Code errorRic August 30, 2012 at 6:54 AM
Don't know if you care (this post is pretty old), but your code is incorrect. The correct version of main is: public static void main(String args[]) { int twoDm[][]= new int[4][5]; int i,j,k=0; for(i=0;i<4;i++) for(j=0;j<5;j++) { twoDm[i][j]=k; k++; } for(i=0;i<4;i++){ for(j=0;j<5;j++) System.out.print(twoDm[i][j]+" "); System.out.println(); } }
Post your Comment