Given the following classes, what is the maximum number of imports that can be removed and have the code still compile?
//Shape.java package com.java2s; public class Shape { } //Printer.java package com.java2s; import java.lang.*; import java.lang.System; import com.java2s.Shape; import com.java2s.*; public class Printer { public void print(Shape shape) { System.out.println(shape); } }
E.
The first two imports can be removed since java.lang
is automatically imported.
The second two imports can be removed because Printer and Shape are in the same package.