7) Java data type, java Data Type
Data Types in Java are classified into basic data types and reference data types:
1) Basic data types include:Boolean, byte, short, char, int, float, long, double. They can be divided into four types: integer, floating point, char, and boolean. Byte, boolean: 1 short, char: 2 int, float: 4 long, double: 8 all basic data types have corresponding data encapsulation types.
Integer: byte, short, int, and long occupy 1, 2, 4, and 8 bytes respectively;
Integer type
Byte (byte type) one byte eight bits, occupies 1 byte. For example, 32B is 0 by default.
The value range is-2 (7-2 (7-1-128 ~ 127
Short (short integer) is a short 16-bit, which occupies 2 bytes. For example, 32 S, the default value is 0.
The value range is-2 (15-2 (15-1-32768 ~ 32767
Int (integer) is an int 32-bit, which occupies 4 bytes. For example 32, the default value is 0.
The value range is-2 (31-2 (31-1-2147483648 ~ 2147483647
Long (long integer) a long 64-bit occupies 8 bytes. For example, 32L is 0 by default.
The value range is-2 (63-2 (63-1-9223372036854774808 ~ 9223372036854774807
Float: long and float occupy 4 and 8 bytes respectively. char occupies 2 bytes and the encoding method is Unicode. The value range is/u0000 ~ /UFFFF; boolean type: boolean occupies 1 byte.
Automatic conversion of data types: (byte, short, char), int, long, float, and double (converted to the corresponding ASCII code value when the char type is converted to an integer) byte, short and char are of the same level, so they cannot be automatically converted to each other. You can use forced type conversion. Conversion between string type and other data types:
String-"Other: String. valueof (...) Other-" String:
Integer.parseInt("66891")
int i = Integer.valueOf("66891").intValue();
2) Reference Data Type(Class, interface, array)