OCA Java SE 8 Building Blocks - OCA Mock Question Building Block 1


Given the following classes, what is the maximum number of imports that can be removed and have the code still compile?

     package com.java2s; 
     public class Shape { } 

     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) { 
  1. 0
  2. 1
  3. 2
  4. 3
  5. 4
  6. Does not compile.




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.