Java   View all facts   Glossary   Help
mechanism > method name overloading
Next mechanismmultithreading    Upmechanism    Previous mechanisminheritance   

method name overloading
(method overloading)
subjectfact 
method name overloadinghas definition A mechanism that allows several methods to have the same name as long as they have different method signatures    added by: DS, reference: Source 2, 2001-10-19 11:37:24.0
does not consider the return type when differentiating between overloaded methodsadded by: JK, source: Teach Yourself Java 2 in 21 Days, 2001-10-19 11:37:24.0
has example
// Two methods have the same name and the same number of parameters
// but different parameter types

public String eats(Cat aCat) {
return "mice";
}

public String eats(Dog aDog) {
return "bones";
}
added by: JK, 2001-10-19 11:37:24.0
is a subtopic of Methods2001-10-19 11:37:24.0
is a kind of mechanismadded by: JK, 2001-10-19 11:37:24.0
makes it possible for methods to behave differently depending on the arguments they receive    added by: JK, source: Teach Yourself Java 2 in 21 Days, 2001-10-19 11:37:24.0
is a synonym of method overloading2001-10-19 11:37:24.0