importing same library into multiple files

I'm working on a project with 2 files

Both need to use objects contained in the library java.io.*

Is there a way to use a single import statement to include this resource in both files?

They're in the same package. How does importing work - if I import in both files will Java actually import twice or will it just use a pointer or what?

thanks.

[380 byte] By [thousea] at [2007-11-27 9:14:22]
# 1
The import doesn't actually import anything. It just tells the compiler what package the classes used in this file are in.
Peetzorea at 2007-7-12 22:02:31 > top of Java-index,Java Essentials,New To Java...
# 2
Agree with Peete.Importing io package wont do much. It just says the required classes are in a particular package/place. No libraries are actually loaded. When the app runs, 'io' is loaded from JRE.
swatcata at 2007-7-12 22:02:31 > top of Java-index,Java Essentials,New To Java...
# 3
so is there a way to consolidate the statements so that I don't have to re-import for every source file I create?
thousea at 2007-7-12 22:02:31 > top of Java-index,Java Essentials,New To Java...
# 4

> so is there a way to consolidate the statements so

> that I don't have to re-import for every source file

> I create?

Did you even read the replies you got? No, there isn't. The compiler needs to know what classes each individual class is dependent on, so you have to be explicit about it

georgemca at 2007-7-12 22:02:31 > top of Java-index,Java Essentials,New To Java...
# 5

> > so is there a way to consolidate the statements so

> > that I don't have to re-import for every source

> file

> > I create?

>

> Did you even read the replies you got? No, there

> isn't. The compiler needs to know what classes each

> individual class is dependent on, so you have to be

> explicit about it

show me where in the replies it says anything about where you have to do your imports and whether or not they can be consolidated - both replies are just answering the second part of my question about what actually occurs during an import -

thousea at 2007-7-12 22:02:31 > top of Java-index,Java Essentials,New To Java...
# 6

> > > so is there a way to consolidate the statements

> so

> > > that I don't have to re-import for every source

> > file

> > > I create?

> >

> > Did you even read the replies you got? No, there

> > isn't. The compiler needs to know what classes

> each

> > individual class is dependent on, so you have to

> be

> > explicit about it

>

> show me where in the replies it says anything about

> where you have to do your imports and whether or not

> they can be consolidated - both replies are just

> answering the second part of my question about what

> actually occurs during an import -

In swatcat's reply, he said "It just says the required classes are in a particular package/place."

"Particular place" implies, to my mind, that it is an explicit declaration.

Was that really the best response to a straightforward answer? You're welcome, by the way

georgemca at 2007-7-12 22:02:31 > top of Java-index,Java Essentials,New To Java...
# 7

> > > > so is there a way to consolidate the

> statements

> > so

> > > > that I don't have to re-import for every

> source

> > > file

> > > > I create?

> > >

> > > Did you even read the replies you got? No, there

> > > isn't. The compiler needs to know what classes

> > each

> > > individual class is dependent on, so you have to

> > be

> > > explicit about it

> >

> > show me where in the replies it says anything

> about

> > where you have to do your imports and whether or

> not

> > they can be consolidated - both replies are just

> > answering the second part of my question about

> what

> > actually occurs during an import -

>

> In swatcat's reply, he said "It just says the

> required classes are in a particular package/place."

>

> "Particular place" implies, to my mind, that it is an

> explicit declaration.

>

> Was that really the best response to a

> straightforward answer? You're welcome, by the way

I'm looking for explicit answers.

No thanks to you

thousea at 2007-7-12 22:02:31 > top of Java-index,Java Essentials,New To Java...