posted 23 years ago
Hello ,please help answer this question with explanation,i.e how to do shift.
What is the output of the following code?
1: int i = 16;
2: int j = 17;
3:
4: System.out.println("i >> 1 = " + (i >> 1));
5: System.out.println("j >> 1 = " + (j >> 1));
A) Prints "i >> 1 = 8"
"j >> 1 = 8"
B) Prints "i >> 1 = 7"
"j >> 1 = 7"
C) Prints "i >> 1 = 8"
"j >> 1 = 9"
D) Prints "i >> 1 = 7"
"j >> 1 = 8"
what is the answer? with explanation