Which of the following can replace line 2 to make this code compile?
Choose all that apply
1: import java.util.*; 2: // INSERT CODE HERE 3: public class Imports { 4: public void method(ArrayList<String> list) { 5: sort(list); 6: } 7: }
B.
The two valid ways to do this are import static java.util.Collections.*; and import static java.util.Collections.sort;.
Option A is incorrect because you can only do a static import on static members.
Classes such as Collections require a regular import.
Option C is nonsense as method parameters have no business in an import.
Options D, E, and F try to trick you into reversing the syntax of import static.