हिंदी

Explain the Various Types of Bitwise Operators in Java.

Advertisements

प्रश्न

Explain the Various Types of Bitwise Operators in Java.

स्पष्ट कीजिए
Advertisements

उत्तर

  1. Bitwise AND Operator (&): This operator compares the corresponding bits of two operands and returns 1 only when both bits are 1. Otherwise, it returns 0.
  2. Bitwise OR Operator (|): This operator compares the corresponding bits of two operands and returns 1 if at least one of the bits is 1. Otherwise, it returns 0.
  3. Bitwise XOR Operator (^): This operator compares the corresponding bits of two operands and returns 1 when the bits are different. If both bits are the same, it returns 0.
  4. Bitwise Complement Operator (~): This is a unary operator that reverses all the bits of an integer value. It changes 0 to 1 and 1 to 0.
  5. Left Shift Operator (<<): This operator shifts the bits of a number to the left by the specified number of positions. Zeros are inserted into the vacant positions on the right.
  6. Signed Right Shift Operator (>>): This operator shifts the bits of a number to the right by the specified number of positions while preserving its sign.
  7. Unsigned Right Shift Operator (>>>): This operator shifts the bits of a number to the right by the specified number of positions and fills the vacant positions on the left with zeros.
shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 6: Variables and Expressions - EXERCISE [पृष्ठ १३१]

APPEARS IN

धीरज मेहरोत्रा Computer Science [English] Class 12
अध्याय 6 Variables and Expressions
EXERCISE | Q 18. (ii) | पृष्ठ १३१
Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×