what is wrong with my 2D array code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what is wrong with my 2D array code

I made this program to print a 2d array it is not working. why? public class blah2  { public static void main (String args[]) { int td[][]= new int [4][5]; int i,j,k=0; for (i = 0; i<4;i++) for (j=0; j<5; j++) {td[i][j]=k; k++; } for(i=0; i<4; i++); {for(j=0; j<5; j++); {System.out.print(td[i][j] + " "); }System.out.println( ); } } }

21st Aug 2016, 7:28 AM
Anshul Rawal
Anshul Rawal - avatar
1 Answer
+ 1
just deleted the ; for both for loops
21st Aug 2016, 7:48 AM
Tiger
Tiger - avatar