The main method in the ListExecutionTimes program contains this local variable initialization statement: ArrayList list = new

Question:

The main method in the ListExecutionTimes program contains this local variable initialization statement:

ArrayList list = new ArrayList<>();

After determining ArrayList execution times, we modified the program by replacing the above statement with this:

LinkedList list = new LinkedList<>();

Declare the list variable in a way that allows you to assign an ArrayList object to it initially and then later assign a LinkedList object to it. Specifically, provide a declaration statement for list, an assignment statement for an ArrayList and an assignment statement for a LinkedList. Why can you assign either an ArrayList object or a LinkedList object to this same variable?

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: