Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Java programming language supports overloading methods , and Java can distinguish between methods with different method signatures. This means that, with some qualifications, methods within a class can have the same name if they have different parameter lists. In method overloading, the choice of determination as to which method to invoke is invoked at runtime is determined at compile time. Even This means that even if the runtime type differs for each invocation, in overloading, the overloaded method invocations depend on associated with the static type of the object at compile timeis invoked.

Wiki Markup
Overloaded methods should be used sparingly, as they can make code much less readableDo not introduce ambiguity while overloading (see [MET01-J. Avoid ambiguous uses of overloading]) and use overloaded methods sparingly \[[Tutorials 2010|AA. Bibliography#Tutorials 10]\]. as Dothey notcan introducemake ambiguitycode whilemuch overloading, for similar reasons \[[Bloch 2008|AA. Bibliography#Bloch 08]\].less readable.

Noncompliant Code Example

This noncompliant code example attempts to use the overloaded display() method to perform different actions depending on whether the method is passed an ArrayList<Integer> or a LinkedList<String>.

...