Home » JAVA Programming » Data Structures » Question
  1. What is the difference between length() and size() of ArrayList?
    1. size() is not defined in ArrayList
    2. ength() and size() return the same value
    3. length() returns the capacity of ArrayList and size() returns the actual number of elements stored in the list
    4. length() is not defined in ArrayList
    5. None of these
Correct Option: C

length() returns the capacity of ArrayList and size() returns the actual number of elements stored in the list which is always less than or equal to capacity.



Your comments will be displayed only after manual approval.