Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Java | Operators | Question 2

  • Difficulty Level : Easy
  • Last Updated : 28 Jun, 2021

Predict the output of following Java program. Assume that int is stored using 32 bits.




class Test {
    public static void main(String args[])  {
       int x = -1;  
       System.out.println(x>>>29);  
       System.out.println(x>>>30);  
       System.out.println(x>>>31);  
   }   
}

(A)

7
3
1

(B)

15
7
3

(C)

0
0
0

(D)

1
1
1


Answer: (A)

Explanation: Please see https://www.geeksforgeeks.org/bitwise-shift-operators-in-java/

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!