*
The moose likes Beginning Java and the fly likes How can I get access to methods in other classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How can I get access to methods in other classes" Watch "How can I get access to methods in other classes" New topic
Author

How can I get access to methods in other classes

Bruce Schmid
Greenhorn

Joined: Apr 06, 2009
Posts: 5
Hi all,
Question, How does a class (A)get access to another classes(B) methods without instantuating the class or inheritance?
Geoff Jefferson
Ranch Hand

Joined: Apr 09, 2009
Posts: 102
In Java classes communicate with one another via objects, or instances of objects.
So, in order for Class(A) to access Class(B) method you will need instantiation at
least.

Take a look at this link: http://java.sun.com/docs/books/tutorial/java/javaOO/index.html


GJ

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38896
    
  23
Anu Pillai
Greenhorn

Joined: Oct 09, 2006
Posts: 28
if the method in class B is declared as static, then cant any method from class A call the method in class B without instantiating or inheritence?
John de Michele
Rancher

Joined: Mar 09, 2009
Posts: 600
Yes, since static methods are associated with a class rather than with an object instance.

John.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I get access to methods in other classes