Что напечатает следующий код:

public static void main(String[] args) {
    int i = 10;
    Integer x = new Integer(10);
    if(x == i) {
        System.out.print("true");
    } else {
        System.out.print("false");
    }
}
Explanation
При компиляции, компилятор добавит к выражению сравнения intValue(), т.е получится x.intValue() == i

Follow CodeGalaxy

Mobile Beta

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