Yet Another Java Short Reference
Ausführlich: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/operators.html
| Zeichen | Anwendung | Bedeutung |
| + | x + y | Addition |
| - | x - y | Subtraktion |
| * | x * y | Multiplikation |
| / | x / y | Division |
| % | x % y | Modulo (Rest nach einer ganzzahligen Division) |
Ausführlich: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arithmetic.html
| Zeichen | Anwendung | Bedeutung |
| > | x > y | größer |
| >= | x >= y | größer oder gleich |
| < | x < y | kleiner |
| <= | x <= y | kleiner oder gleich |
| == | x == y | gleich |
| != | x != y | ungleich |
| ?: | ret = (expr) ? ifTrue : ifFalse; | verkürztes if-then-else-Konstrukt |
| instanceof | obj1 instanceof classA | Typvergleich (fragt auch die Klassenhierarchie ab) |
Ausführlich: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/op2.html
| Zeichen | Anwendung | Bedeutung |
| && | x && y | UND; y wird nicht ausgewertet, wenn x == false |
| & | x & y | UND; x und y werden ausgewertet |
| || | x || y | ODER; y wird nicht ausgewertet, wenn x == true |
| | | x | y | ODER; x und y werden ausgewertet |
| ! | !x | NICHT (Negation) |
| ^ | x ^ y | Exklusives ODER (Entweder oder :-) |
Ausführlich: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/relational.html
| Zeichen | Anwendung | Bedeutung |
| >> | x >> y | shift right; alle bits in x um y Stellen nach rechts schieben |
| << | x << y | shift left; alle bits in x um y Stellen nach links schieben |
| >>> | x >>> y | unsigned shift right |
| & | x & y | bitweises UND |
| | | x | y | bitweises OR |
| ^ | x ^ y | bitweises XOR |
| ~ | ~x | bitweises Komplement |
Ausführlich: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/bitwise.html
| Zeichen | Anwendung | Bedeutung |
| = | x = y | Variable x auf den Wert von y setzen |
| Zeichen | Anwendung | Äquivalent zu: |
| += | x += y | x = x + y |
| -= | x -= y | x = x - y |
| *= | x *= y | x = x * y |
| /= | x /= y | x = x / y |
| %= | x %= y | x = x % y |
| &= | x &= y | x = x & y |
| |= | x |= y | x = x | y |
| ^= | x ^= y | x = x ^ y |
| <<= | x <<= y | x = x << y |
| >>= | x >>= y | x = x >> y |
| >>>= | x >>>= y | x = x >>> y |
| Zeichen | Anwendung | Bedeutung |
| ++ | x++ | x auslesen; dann um 1 erhöhen (Postinkrement) |
| ++x | x um 1 erhöhen; dann auslesen (Preinkrement) | |
| -- | x-- | x auslesen; dann um 1 erniedrigen (Postdekrement) |
| --x | x um 1 erniedrigen; dann auslesen (Predekrement) |
Ausführlich: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/assignment.html
Copyright by Dave Kliczbor