Java OCA OCP Practice Question 1144

Question

What is the result of the following program?

public class Main {
   public static void main(String[] args) {
      int i = 7;
      int j = 8;
      int n = (i | j) % (i & j);
      System.out.print(n);
   }

}
  • A. 0
  • B. 15
  • C. An ArithmeticException is thrown.
  • D. -15


C.

Note

An ArithmeticException is thrown as the result of taking the remainder of a number by 0.




PreviousNext

Related