|
byte
|
8 bits
|
|
short
|
16 bits
|
|
int
|
32 bits
|
|
long
|
64 bits
|
|
boolean
|
1 bit
|
|
char
|
16 bit unicode
|
|
float
|
32 bit decimal
|
|
double
|
64 bit decimal
|
|
-128 to 127
|
|
-27 to 27 -1
|
|
Default value is : 0
|
|
Byte data type is used to save space in large arrays, mainly in place of integers, since a byte is four times smaller than an int
|
|
-32,768 to 32,767
|
|
-215 to 215 -1
|
|
Short data type can also be used to save memory as byte data type. A short is 2 times smaller than an int
|
|
-231 to 231-1
|
|
default data type
|
|
Default value is : 0L
|
|
long Variable_Name = Value_L;
|
|
true and false
|
|
Default value is : false
|
|
Unicode character
|
|
char a = 'A';
|
|
char japanese = "\u....."
|
|
Decimal number
|
|
|
Double
|
64 bits/ 8 bytes
|
|
Float
|
32 bits / 4 bytes
|
|
mydouble = 0.1d
|
doublesci = 1.23e2 (scientific notation)
|
|
myfloat = 0.1f
|
|
|
a=30
|
b=15
|
|
|
+
|
Addition
|
a+b = 45
|
|
-
|
Subtraction
|
a-b = 15
|
|
*
|
Multiplication
|
a * b = 450
|
|
/
|
Division
|
a / b = 2
|
|
%
|
Modulus
|
a % b = 0
|
|
++
|
Increment
|
Increases the value of operand by 1 Ex. b++ = 16
|
|
--
|
Decrement
|
Decreases the value of operand by 1 Ex. b-- = 14
|
|
==
|
equal to
|
|
!=
|
not equal to
|
|
>
|
grater than
|
|
<
|
less than
|
|
>=
|
grater than or equal to
|
|
<=
|
less than or equal to
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.