This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes calling method from another package Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "calling method from another package" Watch "calling method from another package" New topic
Author

calling method from another package

dale con
Ranch Hand

Joined: Apr 15, 2005
Posts: 93
Hello

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.

Layne


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

Cheers
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: calling method from another package
 
Similar Threads
can a contructor be declared protected...
annotations : a little compilation problem
package problem
Package Accessiblty problem
Please Help !!! (package and accessibility)