+ 1

Why is it Arr.length instead of Arr.length(). Is length not a method?

2nd Jul 2016, 9:45 AM
Erdal Sahin
Erdal Sahin - avatar
2 Réponses
+ 4
Srushti is correct, but to go more in depth. the reason that you do not do Arr.length() is because the () is usually referring to a specific or all parameters inside of an array. The Arr.length is referring not to a parameter or a set of parameters, but just how many parameters are consisted within an array. it does not matter what the parameters are; the only thing that matters to .length is the amount of parameters. hope this helps and if so, please upvote. Thanks!
2nd Jul 2016, 4:42 PM
sean
- 1
i think its more an attribute than a method
2nd Jul 2016, 10:09 AM
Srushti Yadhunath
Srushti Yadhunath - avatar