| Author |
Output of this 2Dimensional array ?
|
Anto Telvin
Ranch Hand
Joined: Aug 12, 2008
Posts: 113
|
|
hi i have the following code class f { public static void main(String k[]) { System.out.println("Welcome to 2Dimensional array"); int num[][]=new int[4][5]; int i,j,l=0; for( i=0;i<4;i++) for( j=0;j<5;j++) { num[i][j]=l; l++; } for( i=0;i<4;i++){ for( j=0;j<5;j++) System.out.println(num[i][j]+" ") ; System.out.println(); } } } i am getting output like this 0 1 2 3 4 . upto 19 But i am excepting output like this 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 can anyone tell what is the problem ? thanks
|
Anto Telvin Mathew<br />Many of the life failures are people who did not realize how close they were to success when they give up. EDISON
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
See the issue? If you don't, this should help make it clearer. [ September 08, 2008: Message edited by: Paul Sturrock ]
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
 |
|
|
subject: Output of this 2Dimensional array ?
|
|
|