Question 22
Consider the code given below.
public class ListExample { public static void main(String[] args) { ------------------------------- //LINE 1 ------------------------------- //LINE 2 list1 = new ArrayList<String>(); list1.add("Apples"); list1.add("Grapes"); list2 = new LinkedList<String>(list1); for(String s : list1) System.out.println(s); for(String s : list2) System.out.println(s); }}If the code given above produces the output:
Apples
Grapes
Apples
Grapes
What should be the correct choice for LINE 1 and LINE 2?