Menu
Question Index
...

What will be the output of the following program?

public class Bitwise {
    public static void main(String[] args) {
        int num1 = 0x000F;
        int num2 = 0x2222;
        int num3 = -14;
        num3 >>= 2;
        byte num4 = 15;
        num4 >>= 10;
        int num5 = 65;
        num5 <<= (num2 & num1);
        int num6 = 10;
        int num7 = 3 << 3;
        int num8 = 10 >> 1;
        int num9 = (100 >>> 2) | (2 << 100);
        System.out.print("Output is = " + ((num2 & num1) + num3 + num4 + num5 + num6 + num7 + num8 + num9));
    }
}


Output is = 0
Output is = 342
Output is = 354
Output is = 450
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java Bitwise Operators

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App