There are eight basic java data types, just remember. All of these are references.
Four types of Java, eight basic data types
Class 1: integer byte short int long
Category 2: Float double
Category 3: Logical Boolean (only two values can be true or false)
Class 4: character char
The data that can be directly allocated memory in the stack is the basic data type.
Reference data type: refers to the reference of data in the stack, but its object is in the heap.
To learn java well, you must know where all kinds of data are stored in the memory.
A good understanding of memory can help you analyze programs.
Byte:
Boolean 1/8
Byte byte type 1
Char character type 2 one character can store one Chinese Character
Short short integer 2
Int Integer type 4
Float floating point type (single precision) 4
Long Integer 8
Double double type (double) 8
The default Integer type in Java is int. To define it as float, add L or L to the value;
The default floating point type is double-precision floating point. To define the float type, add f or F to the value.
A single byte is equal to 8 bits, and a single byte is equal to 256 bits, that is, a total of 128 bytes from-127 to 256.
KB is Kbytes
Bytes means byte!
K means a thousand, because the computer is computed in binary format, and the value of 10 "1" is exactly 1024.
1111111111 (Binary) = 1024 (decimal)
1 bytes (bytes) = 8bit (BIT)
An English letter or an Arabic number is a character and occupies one byte.
A Chinese character is two characters, occupying two bytes.
Generally, the size is bytes, and the upper-case "B" indicates that the network speed is bit. Note that the lower-case "B" is used ".
For example, an object contains 8 Mbytes
For example, the download speed of my files is kb/s, that is, 2 Mbit. This is usually the rate at which we access the Internet through broadband.
Automatic conversion of Basic Data Types
Byte-> short, char-> int-> long
Float-> double
INT-> float
Long-> double
Px