File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes How to call class from different package? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to call class from different package?" Watch "How to call class from different package?" New topic
Author

How to call class from different package?

Syskata Mitev
Ranch Hand

Joined: Aug 23, 2006
Posts: 51
i have two packages: Main and Users, so i wont from package Users to call package Main class Begin. Please sorry for my stupid question but i am beginer in the java flexibility.
Deroga Rivera
Greenhorn

Joined: Aug 04, 2005
Posts: 13
You could either import the other package or fully qualify your call.
so import user.begin.* and you can get to all your public methods
Srinivas Kalvala
Ranch Hand

Joined: Oct 20, 2005
Posts: 257

Hello,

Use import statements, make sure that the class is public.


Remeber a Clas Can be : Public or Defualt Package access.

If Default it can be accessed only with in same package.

If public you can access out side of package provided that the class is imported.




Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38851
    
  23
Posted by Srinivas Kalvala
Remeber a Clas Can be : Public or Defualt Package access.
You can also have private or protected class access.
Syskata Mitev
Ranch Hand

Joined: Aug 23, 2006
Posts: 51
thanks a lot java family.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to call class from different package?