Consider the following program and predict the output:
class Main {//from www . jav a2s . co m public void print(Integer i){ System.out.println("Integer"); } public void print(int i){ System.out.println("int"); } public void print(long i){ System.out.println("long"); } public static void main(String args[]) { Main test = new Main(); test.print(10); } }
d)
If Integer and long types are specified, a literal will match to int. So, the program prints int.