Write a program that uses the ArrayList class and populate it with a list of your course codes, i.e MIS210, then use the ArrayList methods described in the example in class to add, remove, and display information about the ArrayList.
simple example of ArrayList:
package bmarina;
import java.util.ArrayList;
public class ArrayListExample {
public static void main(String[] args) {
ArrayList cityList = new ArrayList();
cityList.add(“London”);
cityList.add(“New York”);
cityList.add(“Paris”);
cityList.add(“Toronto”);
cityList.add(“Hong Kong”);
cityList.add(“Singapore”);
System.out.println(“List size is ” + cityList.size());
System.out.println(“Is Toronto in the list? ” + cityList.contains(“Toronto”));
System.out.println(“The location of New York in the list is ” + cityList.indexOf(“New York”));
System.out.println(“Is the list empty? ” + cityList.isEmpty());
cityList.add(2, “Beijin”);
System.out.println(“List size is ” + cityList.size());
System.out.println(“The location of Beijin in the list is ” + cityList.indexOf(“Beijin”));
cityList.remove(“Toronto”);
System.out.println(“List size is ” + cityList.size());
cityList.remove(0);
System.out.println(“List size is ” + cityList.size());
System.out.println(cityList.toString());
for (int i = cityList.size() – 1; i >= 0 ; i–) {
System.out.print(cityList.get(i) + ” “);
}
System.out.println();
}}