Use static imports rarely
java.io
and java.util
, are well known to the typical Java programmer.
When importing such classes, it's reasonable to use an abbreviated style:
import java.io.*;
import java.util.*;
When importing classes that are not among the most widely used, one should probably
use another style, in which each class has an explicit import
statement.
If a class is unfamiliar to a reader, an explicit import
makes it easier to find related documentation.
Example
For example, if a class imports items from the Apache Commons FileUpload tool, then instead of :
import org.apache.commons.fileupload.*;one should likely use the more explicit style :
import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.FileItem; ...etc...