How is the number of elements of a Java array named a obtained?
Correct answer B. a.length
Explanation
Every array has a public final field called length, so it is read without parentheses. The method form length() belongs to String, and size() belongs to collections such as ArrayList, which explains why the three are easily confused. Arrays have no count member, and the length cannot change after creation.
Answer checked How we write and check questions
Discussion