Will the code compile? If so, what will be the result of its implementation?

public class Autoboxing {
    public static void main(String[] args) {
        Integer oInt1 = null;
        Integer oInt2 = 0;
        final int int1 = oInt1;
        final int int2 = oInt2;
        System.out.println(int1 == int2);
Java.lang.NullPointerException will appear in the 5th row, because the compiler translates the expression

final int int1 = oInt1;

final int int1 = oInt1.intValue();

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Sign Up Now
or Subscribe for future quizzes