IT 114: Introduction to Java
Answers to Class 24 Ungraded Quiz

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