I am new to Java and trying to learn Method Overloading and got bit confused. Here is my program
class Adder {
static void add(int a, int b) {
System.out.println("a method invoked");
}
static void add(long a, int b) {
System.out.println("b method invoked");
}
}
class TestMethodOverloading {
public static void main(String[] args) {
Adder.add( 9223372036854775807,12);
}
}
I am getting compiler error saying
java: integer number too large
I am confused why method add with parameter long is not called here?