Overloading Methods and Constructors
One very interesting property of Java is how it allows you to define methods that have the same conceptual functionality as each other by using the same name but changing either the type or number of parameters. Let's see how this could work.
class Age { Â Â Â Â public double a = 0; Â Â Â Â public void setAge ( double _a ) { Â Â Â Â Â Â Â Â a = _a; Â Â Â Â } Â Â Â Â public void setAge ( int year, int month ) { Â Â Â Â Â Â Â Â a = year + (double) month / 12; Â Â Â Â } Â Â Â Â public double getAge () { Â Â Â Â Â Â Â Â return a; Â Â Â Â } } class Example09 { Â Â Â Â public static void main(String[] args) { Â Â Â Â Â Â Â Â Age age = new Age(); Â Â Â Â Â Â Â Â ...