Hi. Lately I seem to import a lot of classes, and I suspect that it would create a large foot-print e.g. import java.awt.image.MemoryImageSource; is in my view better than import java.awt.image.*; So how do I find out which specific classes I need ??? I tried the javac -verbose , is that the only way ?
There is no difference. import java.awt.*; versus import java.awt.Button is the same. When importing you are not 'including' resources in your program. It is just a convenient way to write code so you don't have to specify the fully qualified path to an object.
SCJP 1.4, SCWCD
Java: The power, elegance, and simplicity of a hand grenade
After reading this thread, I realized that the reason that I write specific import statements like java.util.LinkedHashMap instead of java.util.*, is for documentation. I can look at the first few lines of code and see the detailed dependencies. With a relatively small package, such as java.util.regex, it doesn't matter, but for java.util.* or java.sql.* I kind of like to know what parts of the API I'm leveraging. So I will probably continue to import specific classes most of the time. It is nice to know that there aren't any performance penalties for using the "splat" version though. Happy importing! PCS
Philip Shanks, SCJP - Castro Valley, CA
My boss never outsources or has lay-offs, and He's always hiring. I work for Jesus! Prepare your resume!