OCA Java SE 8 Mock Exam 2 - OCA Mock Question 15








Question

What is the output of the following statement?

System.out.println( 16  >>>  3); 
  1. 1
  2. 2
  3. 4
  4. 8




Answer



b

Note

The bit sequence 0001000 is shifted to the right 3 positions with a zero sign fill.

public class Main {
  public static void main(String[] args) {
    System.out.println( 16  >>>  3); 
  }
}

The code above generates the following result.