• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

class loader

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author
Posts: 23919
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic