Java OCA OCP Practice Question 1218

Question

What is the output displayed by the following program?

public class Main {
   public static void main(String[] args) {
      int n = 7;//  ww  w.  j a v  a  2s.  com
      n <<= 3;
      n = n & n + 1 | n + 2 ^ n + 3;
      n >>= 2;
      System.out.println(n);
   }

}
  • A. 0
  • B. -1
  • C. 14
  • D. 64


C.

Note

The variable n takes on the values 7, 56, 57, and then 14.




PreviousNext

Related