AP® Computer Science A glossary
Overloading
Also called: overloaded methods, overloaded constructors
Course: AP® Computer Science A Shows up in: Unit 1: Using Objects and Methods
Having several methods (or constructors) with the same name but different signatures.
Appears in the course and exam description (CED): 1.9.B.41.13.A.3
Java picks the version whose parameter types match the arguments, in order. Two versions with the same parameter types do not compile, even with different parameter names.
System.out.println(Math.abs(-4));
System.out.println(Math.abs(-4.5));
Output:
4
4.5 Learn it properly, with a checkpoint 1.9 Method Signatures