First, the basic data types
1. What is the basic data types?
The basic type, or called built-in type, is a special type different from JAVA classes. They are our programming most frequently used type. java is a strongly typed language, first declared variable data types must be stated, first called variable assignment to initialize variables.
2, eight basic data types
byte: 8 bits and the maximum storage quantity of data is 255, the data stored in the range between -128 to 127.
short: 16 bit maximum data storage capacity is 65536, the data range is from -32768 to 32767.
int: 32 bits data storage capacity is the maximum power of 32 minus 12, the data range is negative 31 th to the 31 th power minus 1 n 2 2.
long: 64 bits and the maximum data storage capacity is 264 minus 12, the data range of negative 63 to the positive power of the 63 th power of 2 minus 1 2.
float: 32 bits data in the range of 3.4e-45 ~ 1.4e38, direct assignment must be added after the number f or F.
double: 64 bits data in the range of 4.9e-324 ~ 1.8e308, d or D can be added to the assignment may not be added.
boolean: Only two values true and false.
char: 16 bits to store Unicode code assignment in single quotes.
2, Java determines the size of each simple type. The size does not change with changes in the structure of the machine. This size can not be changed is the one reason Java programs are so portable capabilities. The following table lists the simple types defined in Java, and corresponds to the number of bits occupied by the wrapper class.
Simple type |
boolean |
byte |
char |
short |
Int |
long |
float |
double |
void |
Binary digit |
1 |
8 |
16 |
16 |
32 |
64 |
32 |
64 |
-- |
Wrapper class |
Boolean |
Byte |
Character |
Short |
Integer |
Long |
Float |
Double |
Void |
See link: https: //www.cnblogs.com/Free-Thinker/p/4573068.html
Second, the float
1. What is a float?
2. Under what scenario will use the float?
3, char type when it will be used?
4. Why packaging?
5, concerning storage of binary bytes, characters, Chinese, English letters, computer?
Transition between the three types of data
1, strong turn
See link: https: //www.cnblogs.com/javastack/p/9111750.html
2, precision is lost
3, memory overflow
Four, BigDecimal Type In Depth
Fifth, reference data types
1, when the object is assigned to note is assigned a reference.
2, when the conversion type into a smaller type, you must pay attention to the results of "narrowing conversion", otherwise they will unwittingly lose the information type conversion process.