Java OCA OCP Practice Question 546

Question

How do you determine the number of elements in an array?

  • A. buses.length
  • B. buses.length()
  • C. buses.size
  • D. buses.size()


A.

Note

Arrays use the length variable to determine the number of elements, making Option A correct.

For an ArrayList, Option D would have been the answer.




PreviousNext

Related