Sail E0 Webinar
Question


What is the output of this program?


class bitwise_operator {
public static void main(String args[])
{
int a = 3;
int b = 6;
int c = a | b;
int d = a & b;
System.out.println(c + " " + d);
}
}
Options:
A .  7 2
B .  7 7
C .  7 5
D .  5 2
Answer: Option A

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:
$ javac bitwise_operator.java
$ java bitwise_operator
7 2



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers