Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Java in General and the fly likes class loader 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 » Java in General
Reply Bookmark "class loader" Watch "class loader" New topic
Author

class loader

neo matrix
Greenhorn

Joined: Apr 22, 2008
Posts: 1
Hi All,
Need your help. I have one question? I have two classes and both have same method say method X. If I call this method (X)from a different class, which class is being called. Please post an answer, thanks in advance.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16688
    
  19

Originally posted by neo matrix:
Hi All,
Need your help. I have one question? I have two classes and both have same method say method X. If I call this method (X)from a different class, which class is being called. Please post an answer, thanks in advance.



It depends on how it is referenced. Methods are referred to by references (static methods can also be referred to by the class name).

If Method(X) is not refereenced, then it will be assumed to be either the current class or the this object. To answer your question, the answer is neither of the two classes with the Method() method -- it is assumed to be part of the calling class.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
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: class loader
 
Similar Threads
what did i break? "no main method found"
thread strategies
How the applet may write a file on the server?
java Applet using cgi-bin - help a young lady in distress
Inner classes