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








Question

Which represent the order in which the following statements can be assembled into a program that will compile successfully? (Choose all that apply)

     A: class Main {}  
     B: import java.util.*;  
     C: package com.java2s; 

  1. A, B, C
  2. B, C, A
  3. C, B, A
  4. B, A
  5. C, A
  6. A, C
  7. A, B




Answer



C, D, E.

Note

package section and import section are both optional.

If both are present, the order must be package, then import, then class.