nerdexam
Oracle

1Z0-803 · Question #55

Identify two benefits of using ArrayList over array in software development.

The correct answer is A. reduces memory footprint D. dynamically resizes based on the number of elements in the list. ArrayList supports dynamic arrays that can grow as needed. In Java, standard arrays are of a fixed length. After arrays are created, they cannot grow or shrink, which means that you must know in advance how many elements an array will hold. But, sometimes, you may not know until

Working with Selected Classes from the Java API

Question

Identify two benefits of using ArrayList over array in software development.

Options

  • Areduces memory footprint
  • Bimplements the Collection API
  • Cis multi.thread safe
  • Ddynamically resizes based on the number of elements in the list

How the community answered

(24 responses)
  • A
    92% (22)
  • B
    4% (1)
  • C
    4% (1)

Explanation

ArrayList supports dynamic arrays that can grow as needed. In Java, standard arrays are of a fixed length. After arrays are created, they cannot grow or shrink, which means that you must know in advance how many elements an array will hold. But, sometimes, you may not know until run time precisely how large of an array you need. To handle this situation, the collections framework defines ArrayList. In essence, an ArrayList is a variable-length array of object references. That is, an ArrayList can dynamically increase or decrease in size. Array lists are created with an initial size. When this size is exceeded, the collection is automatically enlarged. When objects are removed, the array may be shrunk.

Topics

#ArrayList#arrays#Collections API#dynamic resizing

Community Discussion

No community discussion yet for this question.

Full 1Z0-803 Practice