After searching for more information, I came across this site where it is very well explained. Import problem and Does using * in the import statement use performance? .
Is there a performance problem between these two styles? It is possible, but since import ads do not actually import anything into your program, any difference is very small. Remember that there is an implicit import of java.lang. * At the top of your compilation units, and java.lang in JDK 1.2.2 contains 75 classes and interfaces. An experiment using a far-fetched example, one of which uses thousands of class names to look for, showed a slight change in compilation speed. Thus, compilation performance should probably not be seen as a factor when choosing one format over another.
There is one final angle of interest in import declarations. Suppose you use an inner class:
package P; public class A { public static class B {} }
If you want to access A from another compilation unit, you will say:
import P.*;
or: import PA; But if you want to access B without qualifications, you need to say:
import PA*;
or: import PAB; The first one provides available types in class A found in package P. The second allows you to get only type B found in class A in package P.
Juan Carlos Blanco Martínez 09 Oct '08 at 15:23 2008-10-09 15:23
source share