Which statement makes ArrayList available to a program?
import java.lang.ArrayList;import java.io.ArrayList;import java.util.ArrayList;ArrayList lives in the java.util package, so this is the import line the section gives for it.
Explanation
The import statement has to name the package the class actually belongs to. The section states plainly that ArrayList is in java.util and must be imported, and every code example in the topic opens with that import before the constructor call that creates an empty list.
- A is not correct: The section places
ArrayListinjava.util, so naming a different package in the import does not reach the class. - B is not correct: This names a package the section never associates with
ArrayList, so the import would not make the list class available. - D is not correct: The section says directly that
ArrayListmust be imported, so leaving the import out is not an option.