no title...

Page 77

Operator. As a result, values 2 + 3 is evaluated first within the parenthesis then the Multiplication (*) Operator is evaluated. Hence, the value 20 (2 + 3 = 5 and 5 * 4 = 20) is assigned to variable “total” in line 10. According to The Java TM Tutorials, the following is an operator precedence list:

Operator Postfix

Precedence expr++ expr--

Unary

++expr --expr +expr -expr ~ !

multiplicative

*/%

additive

+-

shift

<< >> >>>

relational

< > <= >= instanceof

equality

== !=

bitwise AND

&

bitwise exclusive OR

^

bitwise inclusive OR

|

logical AND

&&

logical OR

||

ternary

?:

assignment = += -= *= /= %= &= ^= |= <<= >>= >>>= Figure 3.15 – Operator Precedence


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.