This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 24183

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.
It is sorta covered in the JavaRanch Style Guide.
subject: import statement
Similar Threads
csv file
Hashcode program error
Variable Declartion
String Object
related to servlet