42.3k views
3 votes
To use an ArrayList in your program, you must import:1. the java.collections package

2. the java.awt package
3. Nothing; the class is automatically available, just like regular arrays.
4. the java.util package
5. the java.lang package

User Awithrow
by
6.4k points

1 Answer

1 vote

Answer:

Option 4: the java.util package

Step-by-step explanation:

ArrayList is one of the Java collections that offer some handy features to manipulate a list of elements. ArrayList is not available in a Java program by default without explicitly import it. To use ArrayList, we need to write an import statement as follows:

import java.util.ArrayList;

After that, we can only proceed to declare an ArrayList in our Java program. For example:

ArrayList<String> studentNames = new ArrayList<String>();

User Hostnik
by
6.1k points