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 GuidesJava  Print This     

Unary Operators (Java and Delphi Cross Reference Guide)

By Mike Prestwood

Java versus Delphi: A side by side comparison between Java and Delphi.

 
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.

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
Delphi: 

An operation with only one operand (a single input). In Object Pascal, a unary operator has the highest precedence and always precedes its operand (for example, -B), except for the  ^ pointer operator, which follows its operand (for example, P^). In addition to the obvious +, -, and Not operators, Delphi also offers:

^ Pointer
@ returns the address of a variable, function, procedure, or method; a pointer to its operand.
inc() Increment
dec() Decrement

The TYPE operator is also a unary operator and is valuated at compile time. The TYPE operator returns the size in bytes of the operand,

More Info / Comment












Sales Website: www.prestwood.com Or visit our legacy sales site: 
legacy.prestwood.com


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