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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 36453
    
  15
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.
 
 
subject: How to call class from different package?
 
Similar Threads
execute JAR from class
A BIG Question Concerning Packages
Using class of the package in other classes in the package?
Class not found in Package
what happen if we call another method within the transaction block