File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes import statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "import statement" Watch "import statement" New topic

import statement

shanker sothi

Joined: Oct 19, 2003
Posts: 4
Say I have a package higherachy like this
here abc is a "abc.class" file.
I want to use it in my current class.
so I import it as
import net.xpack.ypack.*;
when I access it with;//here input is a public method under abc
There is an error?
please help me to solve this.
Arulkumar Gopalan
Ranch Hand

Joined: Oct 13, 2003
Posts: 104
I think you have to import the package where it is located...
import net.xpack.ypack.zpack.*;

Anbudan & Mahalo,<br />Arul<br /> <br />-Not a sun certified Java professional :-)
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

Although it looks as though zpack is "inside" ypack, as far as Java is concerned they're two separate unrelated packages. importing the classes in ypack doesn't tell the compiler to look in zpack, too.

[Jess in Action][AskingGoodQuestions]
shanker sothi

Joined: Oct 19, 2003
Posts: 4
Arul & Hill.
I agree. Here's the link:
subject: import statement
It's not a secret anymore!