Question 735: What will be the output of the program?class BitShift { public static void main(String [] args) { int x = 0x80000000; System.out.print(x + " and "); x = x >>> 31; System.out.println(x); } }
tcs
wipro
infosys
general
aptitude
operators-and-assignments
Option A is correct. The>>>operator moves all bits to the right, zero filling the left bits. The bit transformation looks like this:Before:1000 0000 0000 0000 0000 0000 0000 0000After:0000 0000 0000 0000 0000 0000 0000 0001Option C is incorrect because the>>>operator zero fills the left bits, which in this case changes the sign ofx, as shown.Option B is incorrect because the output methodprint()always displays integers in base 10.Option D is incorrect because this is the reverse order of the two output numbers.