// method overloading
// ==================
// A method may have the same name as another method if you change
// order of arguments, types of arguments, number of arguments, or any 
// combination of these. 
// Note: The following do NOT constitute method overloading:
// + Changing *just* the return type
// + Changing *just* the names of the formal parameters

class Stuff {
    int k = 6;
    void test(int x)           { System.out.println("A: " + x); }
    void test(int x, int y)    { System.out.println("B: " + (x + y)); }
    void test(double x, int y) { System.out.println("C: " + (x + y)); }
    void test(int x, double y) { System.out.println("D: " + (x + y)); }
    void test(double x)        { System.out.println("E: " + x); }
    int  test()                { return this.k; }
}

public class method_overload {
    public static void main(String[] args) {

	Stuff s = new Stuff();   // call default constructor
	s.test(1);
	s.test(1,1);
	s.test(2.0,1);
	s.test(3,1.0);
	s.test(5.0);
	System.out.println("F: " + s.test());
    }

}

/* Output:
   A: 1
   B: 2
   C: 3.0
   D: 4.0
   E: 5.0
   F: 6
*/
