decrement operator

1 topic · 1 source

Technology› Programming

Java

An operator (--) that adds one to its operand. It has two forms: pre-decrement (--x) and post-decrement (x--). In its pre-decrement form, the result of the expression is the value of its argument after the decrement. In its post-decrement form, the result is the value of its argument before the decrement is performed. After the following,

 int a = 5, b = 5; int y,z; y = --a; z = b-- 
y has the value 4 and z has the value 5. Both a and b have the value 4.

Cite this definition

APA
MLA
Chicago