IT 114: Introduction to Java
Answers to Class 24 Ungraded Quiz
What is the class that can create objects that work like arrays but can be expanded or contracted as needed?
ArrayList
Write the statement to create an
ArrayList
object named "words" that will hold strings.
ArrayList<String> words = new ArrayList<>();
Can you create an
ArrayList
object to hold values of type
int
?
no
What method would you use to determine how many elements are in an
ArrayList
object?
size
What method would you use to obtain insert a value into an
ArrayList
object?
add
What method would you use to obtain the value of a particular element in an
ArrayList
object?
get