Operator, Expression and Statement
What is a program?
Variable (e.g. a,b,c,d), Constant (e.g. Integer.MAX_VALUE) and Operator
37 Java operators that act on different type of values:
= > < ! ~ ? : == <= >= != && || ++ -- + - * / & | ^ % << >> >>> += -= *= /= &= |= ^= %= <<= >>= >>>=
different category
Bitwise (e.g. & , | ,^)
Logical Operators (e.g. && , ||, !)
Arithmatic (e.g. +, -, *, /)
Relational (e.g. >, <, >=, <=, ==)
Compound (e.g. +=, -=, ? :)
Assignment (=)
different numbers of operand (e.g. -1, !true, a=3, a==3, a>b?1:2)
precedence and associativity determine the type and value of an expression
e.g. -1 + 3.0*1 + 5/6 -11, a?b:c?d:e?f:g
Assignment Statement e.g. a=-1 + 3.0*1 + 5/6 -11;
assignment compatible i.e. the type of the expression is assignable to the variable
the many kinds of programming statements form a program (Class in Java).
Previou page
Next page