English

Explain the following with an example segment: Bitwise Characters

Advertisements

Question

Explain the following with an example segment:

Bitwise Characters

Code Writing
Explain
Advertisements

Solution

Bitwise Characters in Java refer to the symbols used as bitwise operators to perform operations on individual bits of integer values. These operators work on the binary representation of numbers.

The main bitwise operators are AND (&), OR (|), XOR (^) and NOT (~).

Input Example:

int a = 5, b = 3;
System.out.println(a & b);
System.out.println(a | b);
System.out.println(a ^ b);

Output:

1
7
6
 
shaalaa.com
  Is there an error in this question or solution?
Chapter 6: Variables and Expressions - EXERCISE [Page 131]

APPEARS IN

Dheeraj Mehrotra Computer Science [English] Class 12
Chapter 6 Variables and Expressions
EXERCISE | Q 29. (i) | Page 131
Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×