ArrayList practice

  1. Create an ArrayList of integers.
  2. Put 15 numbers into the ArrayList, where index n contains the number n2.
  3. Print out the contents of the ArrayList. (How is this different from printing out the contents of an array?
  4. Add one to each number in the ArrayList.
  5. Print the ArrayList again to make sure that worked.
  6. Write a method sum that returns the sum of elements in an ArrayList of integers.
  7. Print the sum of the integers in the ArrayList
  8. Write a method that deletes all odd numbers in an ArrayList of integers.
  9. Print out the ArrayList.
  10. Print out its sum