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 calling method from another package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "calling method from another package" Watch "calling method from another package" New topic

calling method from another package

dale con
Ranch Hand

Joined: Apr 15, 2005
Posts: 93

I have a package com.mypackage which has some methods

I have another package com.anotherapckage and i want to use a mehod in com.mypackage. How do i do this?

I've imported the package import com.mypackage then MyClass myclass = new MyClass();, but non of the methods are exposed

Many thanks
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
I need some more information in order to help you. What compiler errors do you get? Also, please post the code for MyClass and the class that is trying to use methods from it.


Java API Documentation
The Java Tutorial
dale con
Ranch Hand

Joined: Apr 15, 2005
Posts: 93
It's OK sorted it. Needed to make the method static

wood burning stoves
subject: calling method from another package
Similar Threads
can a contructor be declared protected...
Package Accessiblty problem
Please Help !!! (package and accessibility)
package problem
annotations : a little compilation problem