• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

import statement

 
shanker sothi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Say I have a package higherachy like this
net.xpack.ypack.zpack.abc
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
zpack.abc.input();//here input is a public method under abc
There is an error?
please help me to solve this.
 
Arulkumar Gopalan
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you have to import the package where it is located...
import net.xpack.ypack.zpack.*;
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
shanker sothi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
Arul & Hill.
Shanker
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic