They're two completely different things.
.length
is a property on arrays. That isn't a method call.
.length()
is a method call on String
.
You're seeing both because first, you're iterating over the length of the array. The contents of the array are String
, and you want to add up all of their lengths, so you then call the length on each individual String
in the array.