Menu
Question Index
...

What will be the output of the following program?

public class Description {
    public static void main(String[] args) {
        int shift = 5000;
        shift >>>= 2;
        System.out.print(shift + ", ");
        shift <<= 3;
        System.out.print(shift + ", ");
        shift = 4;
        shift ^= 2;
        System.out.print(shift + ", ");
        shift = ++shift;
        System.out.print(shift + ", ");
        --shift;
        shift = +shift;
        System.out.print(shift + ", ");
        shift = ~shift;
        System.out.print(shift);
    }
}


625, 5000, 6, 7, 6, -6
1250, 10000, 6, 7, 6, 6
1250, 10000, 6, 7, 6, -7
625, 5000, 6, 7, 6, -7
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