*When you use * in the import statement, which is a wild card, the javac
compiler goes and tries to search the class file relevant to you in the
package specified.
For eg:, for the statement
import java.io.*;
The javac compiler will go to the io package in java folder and try to
find out whether you are using 'File' or some other class file.
In contrast, when you say:
import java.io.File;
It knows, where it has to go. The use of wild card makes the process a bit
slower and its advisable that you use it only when you require the usage of
multiple class files from the same package.
Thanks
Srinivas*
On Sat, Nov 15, 2008 at 2:00 AM, Norman Ho <[EMAIL PROTECTED]> wrote:
>
> > Just a question of not importing tons of code when you need only a few
> > blocks of it.
>
> I thought they would get sorted out at compile time, does it make any
> difference in run time?
>
> On Nov 15, 6:22 pm, miga <[EMAIL PROTECTED]> wrote:
> > On Nov 15, 3:36 am, "Norman Ho" <[EMAIL PROTECTED]> wrote:> What is
> the advantage of specifying multiple import
> >
> > > lines to import different classes in a particular package verse a
> single
> > > line of importing the whole package like import java.util.*;
> >
> > Just a question of not importing tons of code when you need only a few
> > blocks of it.
> >
> >
> >
> >
> >
> > > Thanks
> >
> > > norman- Hide quoted text -
> >
> > - Show quoted text -
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---