Method overloading in java regarding arguments with int/long and String/object
问题 For the following program why the methods with int and String arguments are getting called instead of long and Object? Wanted to know why the compiler is choosing int over long and String over Object arguments. Note: This was asked in an interview. public class MethodOverloadingTest { public static void add(int n, int m){ System.out.println("Int method"); System.out.println(n+m); } public static void add(long n, long m){ System.out.println("Long method"); System.out.println(n+m); } public