It is much more convenient and cleaner to use a single statement like
import java.awt.*;
than to import a bunch of individual classes
The most important one is that importing java.awt.*
can make your program incompatible with a future Java version:
Suppose that you have a class named "ABC", you're using JDK 8 and you import java.util.*
. Now, suppose that Java 9 comes out, and it has a new class in package java.util
that by coincidence also happens to be called "ABC". Your program now will not compile on Java 9, because the compiler doesn't know if with the name "ABC" you mean your own class or the new class in java.awt
.
You won't have that problem when you import only those classes explicitly from java.awt
that you actually use.
Resources:
Java Imports