Recently I was experimenting with Bufferedreader and came across a web example that you see below.
(I only included the top part of the code).
My question is this: Wouldn't I want to use some abreviation notation for the import statements?
Wouldn't import.java.io.* be better than listing each out individually? Many thanks.
Charles Angemeyer wrote:My question is this: Wouldn't I want to use some abreviation notation for the import statements?
Wouldn't import.java.io.* be better than listing each out individually?
You certainly can, but I tend not to; and it sounds like you're probably using an IDE, most of which create them as you've shown.
I guess my question to you is: why would you bother? The savings are ONLY at compile time (and even then we're talking milliseconds); it makes absolutely no difference whatsoever to your runtime class.
Winston
Isn't it funny how there's always time and money enough to do it WRONG?
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32689
4
posted
1
Using individual imports has two advantages.
1: You have a list of classes (etc) used in your application (or at least in the current class).
2: There is less risk of collisions, eg between Timers.