This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Overloading doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Overloading doubt" Watch "Overloading doubt" New topic
Author

Overloading doubt

ketan khairnar
Greenhorn

Joined: Dec 21, 2004
Posts: 15
Why it is necessary(must) for arguments to differ?
Kris Reid
Ranch Hand

Joined: Jan 05, 2005
Posts: 247
overloading example

public void methodA(int a) {}
public void methodA(int a, int b) {}

they need to have different signatures so it knows which to call.
if they where
public void methodA(int a) {}
public int methodA(int a) {}

how the compiler know which method you are after?

Hope that makes sense
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Overloading doubt