You are on page 1of 2

OPERATORS

% Computes the remainder

++ op++ increments op by 1, evaluates to the value of op before it was incremented

++ ++op increments op by 1: after

-- op-- decrements op by 1: before

-- --op decrements op by 1: after

Ex. Int age;

System.out.println(Your age is age++); age=20

(Your age is ++age);age=21

(Your age is age--); age=20

(Your age is ++age);age=19

6 LOGICAL OPERATORS

&& short-circuit evaluation

Ex. exp1&&exp2 (exp may be true or false)

If exp1 is false, it will not proceed to exp2

TRUTH TABLE:

X1 X2 RESULT
TRUE TRUE TRUE
TRUE FALSE FALSE
FALSE TRUE FALSE
FALSE FALSE FALSE

&

If exp1 is false, will STILL proceed to exp2

|| logical OR
| inclusive OR

X1 X2 RESULT
TRUE TRUE TRUE
TRUE FALSE TRUE
FALSE TRUE TRUE
FALSE FALSE TRUE
Int i=0;

Int j=10;

Boolean text=false

Test=(i<10)||(j++>9)

Syste.out.println(i);0

(j);10

(test)-

You might also like