If a String is immutable, then why do you have to call a method to get the length instead of just accessing a variable, like array.length?

Viewed 301

It seems to me that calling string.length() each time takes significantly longer than just accessing a variable.

6 Answers
Related