aspose file tools*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 36453
    
  15
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How can I get access to methods in other classes
 
Similar Threads
Singleton
Thread class
Inner classes
Way to get classes used within a class?
What's the deal with private classes