Hi all,
I am new to java and now in the period of studying java language. I
have a question about class inheritance. If I declare "import ..."
statement to import a certain package in the a class, should I need to
import that package again in that class's subclass if i want to use
the same package with the superclass?
Thanks in advance!
Andrew Thompson - 21 Oct 2005 04:25 GMT
> I am new to java and now in the period of studying java language. I
> have a question about class inheritance. If I declare "import ..."
> statement to import a certain package in the a class, should I need to
> import that package again in that class's subclass if i want to use
> the same package with the superclass?
What happened when you tried it? The compiler will tell you
if the sub-class is attempting to access a class that is not
available to it, via imports. (Your computer will not explode
if you try it & 'fail').
Roedy Green - 21 Oct 2005 08:28 GMT
> I am new to java and now in the period of studying java language. I
>have a question about class inheritance. If I declare "import ..."
>statement to import a certain package in the a class, should I need to
>import that package again in that class's subclass if i want to use
>the same package with the superclass?
You don't need to import classes used by methods you inherit, but you
do need to reimport any classes you use yourself.
see http://mindprod.com/jgloss/package.html
You don't have to worry to much about imports. If you don't get them
right, the compiler will bitch until you add them. If you use an IDE
like Eclipse it will prune out unneeded ones for you, or take generic
* imports and convert them into an explicit class list.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.