Which two statements, added independently at the beginning of the program, allow the code to compile?
/* Missing statements ? */
public class NewArrayList extends java.util.ArrayList {
public static void main(String[] args) {
java.util.ArrayList list = new java.util.ArrayList();
list.add("Hello");
Collections.sort(list);
}
public void clearList() {
HashSet set = new HashSet();
set.clear();
}
}
1. No statement is required
2. import java.util.*;
3. import java.util.Hash*;
4. import java.util.ArrayList;
5. import java.util.Collections;
6. import java.util.HashSet;
Choose the correct answer:
1
2 and 4
2
3 and 5
3
2 and 5
4
2 and 6
5
Question Not Attempted