My thoughts as an enterprise Java developer.

Friday, October 19, 2007

Autoboxing quiz

Does widening or autoboxing happen first? Which param method will be called from the autoboxing method? If one param method is commented out then it will have no problem calling the other.

private static void autoboxing() {
Integer integer = new Integer(2);

private static void param(int param) {
System.out.println("param(int " + param + ")");

private static void param(Object param) {
System.out.println("param(Object " + param + ")");

No comments: