Menu
Question Index
...

Compare the following program?

public class CrossCheck1 {
    public static void main(String args[]) {
        short s = 10;
        int a = s;
        s += 10;
        System.out.println(s + "," + a);
    }
}

public class CrossCheck2 {
    public static void main(String args[]) {
        short s = 10;
        int a = s;
        s = s + 10;
        System.out.println(s + "," + a);
    }
}


Both CrossCheck1 and CrossCheck2 produce same output.
CorssCheck1 does not compile, but CorssCheck2 will compile.
CorssCheck2 does not compile, but CorssCheck1 will compile.
Both CorssCheck1 and CorssCheck2 compile, but they produce different output.
Both CorssCheck1 and CorssCheck2 does not compile.

Doubts

Problems

Topic: Arithmetic Compound Assignment Operators In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App