Uncommon classes need explicit imports

Widely used classes, such as those in 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.


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;

See Also :
Use static imports rarely
Would you use this technique?
Yes   No   Undecided   
© 2018 Hirondelle Systems | Source Code | Contact | License | RSS
Individual code snippets can be used under this BSD license - Last updated on September 21, 2013.
Over 2,000,000 unique IPs last year - Built with WEB4J.
- In Memoriam : Bill Dirani -