Home / CSE MCQs / JAVA MCQs :: Discussion

Discussion :: JAVA MCQs

  1. Which of these method can be used to increase the capacity of ArrayList object manually?
  2. A.
    Capacity()
    B.
    increaseCapacity()
    C.
    increasecapacity()
    D.
    ensureCapacity()

    View Answer

    Workspace

    Answer : Option D

    Explanation :

    When we add an element, the capacity of ArrayList object increases automatically, but we can increase it manually to specified length x by using function ensureCapacity(x)


Be The First To Comment