Java OCA OCP Practice Question 229

Question

Given the following class definition.

what is the maximum number of import statements that can be discarded and still have the code compile?

For this question, assume that the MyClass class is in the food.mypkg package.

The Apple class is in the food.fruit package.

package food; 
import food.mypkg.*; 
import food.fruit.*; 
import java.util.Date; 
 
public class Grocery { 
   Apple a; MyClass b;  Date c; 
} 
  • A. 0
  • B. 1
  • C. 2
  • D. 3


A.

Note

All of the import statements in this class are required.

Removing any of them would cause the class to not compile.

Option A is the correct answer.




PreviousNext

Related