What will the program print when compiled and run?.
public class Main { public static void main(String[] args) { Integer i = new Integer(-10); Integer j = new Integer(-10); Integer k = -10;/*from w ww.j a v a2 s . c o m*/ System.out.print(i==j); System.out.print(i.equals(j)); System.out.print(i==k); System.out.print(i.equals(k)); } }
Select the one correct answer.
(a) falsetruefalsetrue (b) truetruetruetrue (c) falsetruetruetrue (d) truetruefalsetrue (e) None of the above.
(a)
Using the new operator creates a new object.
Boxing also creates a new object if one is not already interned from before.