Consider the following program and determine the output:.
public class Main { public void print(Integer i) { System.out.println("Integer"); }/*w ww.j a v a 2 s. c o m*/ 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.