InterviewSolution
Saved Bookmarks
| 1. |
What is the difference between length() and size() of ArrayList?(a) length() and size() return the same value(b) length() is not defined in ArrayList(c) size() is not defined in ArrayList(d) length() returns the capacity of ArrayList and size() returns the actual number of elements stored in the list |
|
Answer» Correct answer is (d) length() returns the capacity of ArrayList and size() returns the actual number of elements stored in the list Explanation: 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. |
|