package overloading;
public class OverloadingExample2 {
    public static void main(String[] args) throws Exception {
        
        int n1 = 5;
        int n2 = 10;
        double n3 = 1.0;
        double n4 = 3.33;

        // which one executes?
        doThings(n1, n2);  // n1 and n2 are integers
        doThings(n3, n4);  // n3 and n4 are doubles
        doThings(n2, n4);  // n2 is an int, n4 is a double
        doThings(n3, n2);  // n3 is a double, n2 is an int

        //doThings(1, "foo"); // no match: no doThings(int, String);
        //doThings(1); // no match: no doThings(int)
        //doThings(1.5); // no match: no doThings(double)
    }

    public static void doThings(int a, int b) {
        System.out.println("I take two integers.");
    }
    public static void doThings(double a, double b) {
        System.out.println("I take two doubles");
    }
    public static void doThings(int a, double b) {
        System.out.println("I take one int and one double.");
    }

    // why is this a problem?
    // public static void doThings(int x, int y) {
    //     System.out.println("Nope.");
    // }

}
