+ 1
Why is it Arr.length instead of Arr.length(). Is length not a method?
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!
- 1
i think its more an attribute than a method