Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

basic newbie class method question

Status
Not open for further replies.

trium123

IS-IT--Management
Apr 8, 2005
15
GB
Hi there, please excuse me for asking what i would imagine is an easy question for some..!
I have two unrelated classes and would like to know the basic syntax for accessing a method in one class from a method in the other..
Is it something like (from classA)
classB.methodA()?
or am i miles out?
Thanks for anyone wiling to help a me out..
 
Hi

That way you call a static method. To call non-static methods, you have to instantiate an object from that class and call the method like [tt]objectOfClassB.methodA()[/tt].

Feherke.
 
Hi trium123. Are you reading any Java training material? The reason I ask is that, yes, you can ask questions like this of us to learn the stuff, but it would be MUCH faster for you to read something like Bruce Eckel's 'Thinking in Java', or a good beginners book.

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top