Java's Object Orientation, I/O
CS 161 - Java
Overloading
Two or more methods may have the same
name
but take different sets of
arguments
; they have different
signatures
.
This is called
overloading
.
Method signatures must differ by the type and/or number of arguments,
not
only by the data type they return;
A common use of overloading in Java is to have multiple constructors, each taking a different set of arguments.
Question:
Why would this be useful?
jwd