General
- abstraction
- encapsulation
- enum
- inheritance
- inner classes
- polymorphism
- precedence (answer)
Operators
| - | Unary Minus Operator |
| + | Unary Plus Operator |
| ++ | Increment Operator |
| -- | Decrement Operator |
| ! | Logical Complement Operator (Only takes boolean types as operands) |
| ~ | Bitwise Complement Operator |
| + - * / % | Arithmetic Operators (+ addition, - subtraction, * multiplication, / division, % modulus) |
| == | Equality Operator |
| < > <= >= | Relational Operator |
| && || | Conditional Operator |
| ? : | Ternary Operator (expression)? true_statements : false_statements ; |
| << >> | Shift Operator (Only takes integer-convertible types as operands) |
| >>> | Unsigned Right Shift Operator (Only takes integer-convertible types as operands) |
| = | Assignment Operator (There are 12 of them and only integer-convertible types as operands) = += -= *= /= %= <<= >>= >>>= &= ^= |= |
| & | ^ | Integer Bitwise Operators |
Examples
int j = 2; int k = ~j; // k = -3; j = 2; boolean z = x != y; // byte x = 5; byte z = -x; // error byte y = (byte) -x; // correct short x = 200; short y = 400; short z = x + y ; // error short z = (short) (x + y); // correct // // The casting is necessary or an integer will be assigned to pi final float pi = (float) 22 / 7; //
No comments:
Post a Comment