60 503
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #3565 in Java | JSP | JSF for Y mukundareddy

Question #3565
(3) Write a program to perform all bitwise operators on the following variables a=50, b=20?
Expert's answer
public class Bitwise {

static int a = 50;
static int b = 20;

public static void main(String[ ] args) {
int c = a^b;
System.out.println("a ^ b =" +c);
c = a&b;
System.out.println("a & b =" +c);
c = a|b;
System.out.println("a | b =" +c);
c = a^b;
System.out.println("a ^ b =" +c);
a&=b;
System.out.println("a &= b =" +a);
a = 50;
a^=b;
System.out.println("a ^= b =" +a);
a = 50;
a|=b;
System.out.println("a |= b =" +a);
a = 50;
c = a<<b;
System.out.println("a << b =" +c);
c = a>>b;
System.out.println("a >> b =" +c);
c = a>>>b;
System.out.println("a >>> b =" +c);
a<<=b;
System.out.println("a <<= b =" +a);
a = 50;
a>>=b;
System.out.println("a >>= b =" +a);
a = 50;
a>>>=b;
System.out.println("a >>>= b =" +a);
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions