Crouchez said:
Is importing a class directly ie.
import java.io.InputStream
more efficient than
import java.io.*;
It has no effect on the generated class, so no effect on runtime efficiency.
It's probabaly a hair faster to compile.
As a developer, I prefer specific imports, as it's easy to expand a classname
if the import is there, rather than having to search through a bunch of
packages to see where SomeFooAccessor is defined.
What happens? Does the JVM import all the classes if using a wildcard?
No. The JVM doesn't see imports. They're thrown away by the compiler. The
compiler uses them to replace short type names with fully-qualified names.
There is no bytecode difference between importing specific names, wildcards,
and not importing anything in favor of using fully-qualified names everywhere.