Skip to content
CodeKruPro

Compound assignment hides a cast

Predict the outputMediumJava only
Main.java
public class Main {
    public static void main(String[] args) {
        int x = 5;
        x += 3.7;
        System.out.println(x);
        char c = 'a';
        c += 2;
        System.out.println(c);
        short s = 10;
        s *= 1000;
        System.out.println(s);
    }
}

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in