1, integer
Integer is a type that stores integers, which can represent any number. In a computer, integer data exists in the form of integers, which can be added, subtracted, multiplied and divided. Integer data takes up less memory, so it is often used to store and process numbers, such as storing data in a computer and drawing charts.
2, floating-point type
Floating-point type is a data type, including two data types, namely single precision and double precision. Single precision is a very high precision data type, which can store 7 significant digits after the decimal point. Double precision is a data type with relatively low precision, which can store 8 significant digits after the decimal point. Floating-point type is used to store decimal points in programs, which can be accurately calculated and compared.
3. Character type
A character type is a data type used to represent a single character. It takes up 2 bytes and can represent any character in the Unicode character set. Character data is represented by the keyword char in Java, and the value range is 0~65535. Character data is represented by String in Java, which takes up 2 bytes and can represent strings of any length.
4. Boolean type
Boolean data is one of the most basic data types in computer programming. Boolean data occupies 1 byte in memory to store 8-bit true or false. It can only have two values of true and false, and 0 and non-zero integers cannot replace true and false. Boolean type can represent true or false and is used for conditional judgment, such as if statement, while statement, etc.
5、int
Int is a basic data type used to store integers. It can occupy 4 bytes and 64 bits. In Java, the int type is a 32-bit signed two's complement integer with values ranging from -2 147483648 to 2 147483647. It can be used to store all kinds of data, including numbers, characters, dates and so on. Int type occupies 32 bytes of memory and can represent a 4-byte integer.