Mike <SulfateIon@gmail.com> wrote:
>> In array, ... a.length
>>
>> of a string, ... a.length()
>>
>> Why is there no parenthesis in the former, and is there parenthesis in
>> the latter?
> Because the Java API is inconsistent. For lists, you use list.size().
It isn't an issue of API consistency. Arrays are one of the essential
elements of Java - they're not called "java.lang.array"s. They're part of the
language, not the API. The Collections are not part of the language.
If both were in the language, or both in the API, we could discuss consistency.
In any event, EricF's answer is the answer:
> But to answer your question, for arrays, length is an attribute. For strings,
> length is a method.

Signature
Lew