White space and comments may appear before or after any of these elements. : import « Java Source And Data Type « SCJP






// Package declaration
package exam.prepguide;

// Imports
import java.awt.Button; // imports a specific class
import java.util.*;     // imports an entire package

// Class definition
public class Test {
   // class body

}








1.4.import
1.4.1.You may import either an individual class from a package or the entire package.
1.4.2.White space and comments may appear before or after any of these elements.
1.4.3.To use classes with the same name in two different packages
1.4.4.Reference class without importing
1.4.5.Reference class with importing
1.4.6.Java compiler automatically imports all the classes in the java.lang package into every source file.