IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
To/From Code
-Collapse +Expand Cross Ref Guide
-Collapse +Expand Members-Only
Sign in to see member-only pages.
   ► KBTo/From GuidesC#  Print This     

Unary Operators (C# and Java Cross Reference Guide)

By Mike Prestwood

C# versus Java: A side by side comparison between C# and Java.

 
Operators
 

A language symbol used for assignment, comparison, computational, or as a logical.

Unary Operators

[Other Languages] 

General Info: Unary Operator

An operation with only one operand (a single input). Common unary operators include + plus, - minus, and bitwise not. Some operators can function as both unary and binary operators. For example, + and - operators can serve as either.

Languages Focus

What unary operators are supported in additoin to the standard plus, minus, and bitwise not.

C#: 

An operation with only one operand (a single input). The following are the C# unary operators: +, -, !, ~, ++, --, true, or false. 

Java: 

An operation with only one operand (a single input). The Java unary operators are ++, --, +, -, ~, and !.

  • + Indicates positive value (numbers are positive without this)
  • - Negates an expression
  • ++ Increment operator by 1
  • -- Decrement operator by 1
  • ! Logical complement operator (inverts the value of a boolean)
  • ~ Bitwise inversion operator (works on integral data types)
More Info / Comment












Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2024 Prestwood IT Solutions.   [Security & Privacy]