 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP 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
Java Unary Operator Examples
The unary operator works on a single operand. Following are the examples of unary operators supported in java. Assume A = 60 and B = 20.
| Operator | Description | Example | 
|---|---|---|
| ~ (bitwise compliment) | Binary One's Complement Operator is unary and has the effect of 'flipping' bits. | (~A ) will give -61 which is 1100 0011 in 2's complement form due to a signed binary number. | 
| ++ (Increment) | Increases the value of operand by 1. | B++ gives 21 | 
| -- (Decrement) | Decreases the value of operand by 1. | B-- gives 19 | 
Advertisements
 