0

Array initialisation

int a[ ][ ]=new int [5][5]; for (int i=0;I<5;I++) { for(int j=0;j<I+1;j++) System.out.print(a[i][j]+" "); } System.out.println(); this code outputs 0 0 0 0 0 0... and so on.. Why so? since I didn't initialise the array values. how does it give 0? I hope I made myself clear.

13th Jan 2017, 8:28 AM
Divyanshu Bhatnagar
Divyanshu Bhatnagar - avatar
2 odpowiedzi
+ 1
Default value of uninitialized variables of int, float, double is 0.
13th Jan 2017, 8:30 AM
Jakub Stasiak
Jakub Stasiak - avatar
0
okay, Thanks :)
13th Jan 2017, 9:01 AM
Divyanshu Bhatnagar
Divyanshu Bhatnagar - avatar