System.out.println(4 | 3);

  1. 6

  2. 0

  3. 1

  4. 7


Correct Option: D

AI Explanation

To answer this question, we need to understand the bitwise OR operation.

The bitwise OR operation (|) is a binary operation that takes two operands and performs a bitwise OR on each corresponding bit of the operands.

In this case, we have the numbers 4 and 3. Let's convert them to binary:

4 in binary: 100 3 in binary: 011

Performing the bitwise OR operation on each corresponding bit, we get:

100

OR 011

111

Converting the result back to decimal, we get 7.

So, when we execute the statement System.out.println(4 | 3);, the output will be 7.

Therefore, the correct answer is option D.

Find more quizzes: