mention default values of the following data types .Boolean and long
Answers
boolean data type:
The default value of boolean(primitive) data type is false.
The Boolean data type is used to store only two possible values: true and false. This data type is used for simple flags that track true/false conditions.
It specifies one bit of information, but its "size" can't be defined precisely.
long data type:
The default value of long data type is 0L.
The long data type is a 64-bit two's complement integer. Its value-range lies between (-2^63) to(2^63 -1).
Other primitive data type default values and size:
DataType DefaultValue Defaultsize
- boolean false 1 bit
- char '\u0000' 2 byte
- byte 0 1 byte
- short 0 2 byte
- int 0 4 byte
- long 0L 8 byte
- float 0.0f 4 byte
- double 0.0d 8 byte
Default values:
1. boolean(primitive) = false
Boolean(wrapper) = null
2. long = 0L
Additional Information:
1. boolean can only store 2 values, true and false.
It has a size of 1 bit.
2. long: its range lies between -2⁶³ and 2⁶³-1 (inclusive).
It has a size of 8 bits.