- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Shift operator works on bits and performs shift operation to move bits on either leftwards or rightwards. Assume if a = 60 and b = 13; now in binary format they will be as follows −

Operator | Description | Example |
---|---|---|

<< (left shift) | Binary Left Shift Operator. The left operands value is moved left by the number of bits specified by the right operand. | A << 2 will give 240 which is 1111 0000 |

>> (right shift) | Binary Right Shift Operator. The left operands value is moved right by the number of bits specified by the right operand. | A >> 2 will give 15 which is 1111 |

>>> (zero fill right shift) | Shift right zero fill operator. The left operands value is moved right by the number of bits specified by the right operand and shifted values are filled up with zeros. | A >>>2 will give 15 which is 0000 111 |

- Related Questions & Answers
- Left Shift and Right Shift Operators in C/C++
- What are shift operators in C++?
- Bitwise right shift operators in C#
- C# Bitwise and Bit Shift Operators
- What are the bitwise zero fill right shift zero operators in Java?
- What are the main shift operators provided by Java? Explain with an example?
- What are Left Shift and Right Shift Operators (>> and <<) in C#?
- Java Shift Operator Examples
- Java Relational Operators
- Java Bitwise Operators
- Java Logical Operators
- Java Assignment Operators
- Java Boolean operators
- Java arithmetic operators
- Java Operators Precedence

Advertisements