Given the following classes, which of the following can independently replace INSERT IMPORTS HERE to make the code compile?
//Shape.java package com.java2s; public class Shape { } //Employee.java package com.java2s.beans; public class Employee { } // package printer; INSERT IMPORTS HERE public class Printer { public void admire(Employee jelly) { } }
C, D.
C is correct since it imports Employee by classname.
D is correct since it imports all the classes in the beans package, which includes Employee.
A is incorrect because it only imports classes in the com.java2s package-Shape in this case-and not those in lower-level packages.
B is incorrect since wildcards can only be used at the end of an import statement.
E is incorrect since we cannot import parts of a class with a regular import statement. We can use static import to import static methods and fields.