0

int[ ] x= new int[7+0]. when check length it shows 7.... while if it counts from 0 it should have a pength of 8.

18th Jul 2016, 10:51 AM
Vaibhav
Vaibhav - avatar
4 Respostas
0
It will count from 0 to 6 not 0 to 7 so the length is 7
18th Jul 2016, 4:45 PM
Dilip Belgumpi
Dilip Belgumpi - avatar
0
see when it counts it counts from 0-6 which total value is 7. while counting it counts TILL that number (excluding the number). hope you got my point
19th Jul 2016, 6:08 AM
Amit Karn
Amit Karn - avatar
0
the index of array starts counting from zero not size. array having size 1 will have only index zero 0
19th Jul 2016, 8:43 PM
M Saif Ullah
M Saif Ullah - avatar
0
but when i add 0 it should place a no. at 0 as well but now i got it as the 0 is already initialized so it is not gonna count 0 again
20th Jul 2016, 4:42 AM
Vaibhav
Vaibhav - avatar