Given:
3. public class Main { 4. public static void main(String[] args) { 5. Integer i = 420; 6. Integer i2; 7. Integer i3; 8. i2 = i.intValue(); 9. i3 = i.valueOf(420); 10. System.out.println((i == i2) + " " + (i == i3)); 11. } }
What is the result?
D is correct.
In this code, lines 8 and 9 each create a new Integer object, and == tests whether two references refer to the same object.