Primitive | Range | Description |
---|---|---|
Boolean | 0 to 1 | One bit only; make only hold the values true or false. May not be cast into another data type or vice-versa. These values are usually stored as True or False. |
Byte | -128 to 127 | 8 bits. |
Short | -32,768 to 32,767 | 16 bits |
Int | -2,147,483,648 to 2,147,483,647 | 32 bits. |
Long | -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 | 64 bits. |
Float | +/- 3.4 * 10e38 | 4 bytes. |
Double | +/- 1.8 * 10e308 | 8 bytes |
Char | 0 to 65,535 | Unicode; not the same as bytes, ints, shorts, or Strings. |
Operator/Operation | Description |
---|---|
+ | Addition |
- | Subtraction |
* | Multiplication |
/ | Division |
% | Modulus |
+= | Add and assign |
-= | Subtract and assign |
*= | Multiply and assign |
/= | Divide and assign |
%= | Modulus and assign |
++ | Increment by one |
-- | Decrement by one |
+ | Unary positive sign |
- | Unary negative sign |
Math.cos(double a) | Returns trigonometric cosine of an angle. |
Math.sin(double a) | Returns trigonometric cosine of an angle. |
Math.tan(double a) | Returns trigonometric tangent of an angle. |
Math. sqrt(double a) | Returns a correctly rounded square root value. |
Math.pow(double a, double b) | Returns the value of the first argument raised to the power of the second argument. |