Home » JAVA Programming » Basic Operators » Question
  1. What is the output of this program?

    public class Bitwise_Operator
    {
    public static void main(String args[])
    {
    int p = 8;
    int q = 8;
    int r = p | q;
    int s = p & q;
    System.out.println(r + " " + s);
    }
    }
    1. 9 9
    2. 7 7
    3. 8 8
    4. 10 10
    5. 5 5
Correct Option: C

And operator produces 1 bit if both operand are 1. Or operator produces 1 bit if any bit of the two operands in 1.
output: 8 8



Your comments will be displayed only after manual approval.