Write a program that creates an ArrayList of ints. Then, add the first 10 odd integers to the ArrayList. Finally, print out the contents of the ArrayList.
import java.util.*;class Main { public static void main(String[] args) { List<Integer> array_list = new ArrayList<Integer>(); int x = -1; for (int i = 0; i<10; i++){ x = x+2; array_list.add(x); } System.out.println(array_list); }}
import java.util.*; class Main { public static void main(String[] args) { List<Integer> array_list = new ArrayList<Integer>(); int x = -1; for (int i = 0; i<10; i++){ x = x+2; array_list.add(x); } System.out.println(array_list); } }