Exam Prep Practice Questions

Question 1 You are writing a utility class and your company's policy is to keep utility classes in a package named conglomo.util. Select the correct code fragment to start a class file for a class that uses classes in the java.awt and java.util standard library packages.
  • A.

    1. package java.conglomo.util
    2. import java.awt.*
    3. import java.util.*
    
  • B.

    1. package conglomo.util ;
    2. import java.awt.* ;
    3. import java.util.* ;
    
  • C.

    1. import java.awt.* ;
    2. import java.util.* ;
    3. import conglomo.util.* ;
    
  • D.

    1. package conglomo.util ;
    2. import java.*.* ;
    
A1: Answer B is correct. Note that the package statement must be the first compiler-usable statement. It can follow comment lines and blank lines but must precede all ...

Get Java 2™ Programmer Exam Cram™ 2 (Exam CX-310-035) now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.