Java | Operators | Question 2
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
Last Updated :
28 Jun, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...