Java is a strongly typed programming language, so when declaring a variable, you must declare the data type, the Java language has the basic data type and the reference data type two big data types, the basic data type has 8 kinds are 4 integral type, 2 kind of floating-point type, There are 1 types of characters used to represent character cells in Unicode, and 1 Boolean types that represent true values; Reference data types have interfaces (interface), arrays, and classes (class) that can be used to make a detailed classification:
The basic data types are the various types of keywords, the range of values, the size of the memory, and the default as follows:
Integer type
A numeric value that represents a part without decimals, or a negative number that has an integer (int) of 4 bytes, a byte type (byte) of 1 bytes, a short integer of 2 bytes, a long integer (long) of 8 bytes, and an int type commonly used in Java. In the case of byte and short types, the scope of the int type is not related to the running machine, which solves the problem of the platform porting of the software or the inconvenience caused by different operating systems. Small knowledge points in java7 indicate that the binary number is preceded by a 0b and can also be underlined ("_") between the numbers, for example: 0b1010_0111, underlining is just for readability to be removed when compiling the underline.
Floating point Type
Represents a fractional part, which has two forms, one of which is a single-precision floating-point type (float), a double-precision floating-point type (double) with a 7-bit valid decimal number and a 15-bit valid decimal number, and no suffix "F" for a single-precision floating-point type, which in Java defaults to a double type. Therefore, a single-precision floating-point type is best followed by a suffix F, of course, a double followed by the suffix "D" plus a clear. All floating-point types follow the IEEE754 specification, which says a special three case, positive infinity, negative infinity, and not a number (Nan), for example: A positive integer divided by 0 is positive infinity, 0 divided by 0 or negative square root is NaN.
Character type
Used to represent a single character, typically used to denote a character constant, for example: ' A ' is a character constant corresponding to the encoding 65. Everything is not absolute, there are more special character constants such as:
For the situation at the time (in which case you can see privately), Java's character type employs 16 bits, which are actually 2 bytes.
Boolean type
Representation logic, in Java there are only two values ture and False, numeric and Boolean values cannot be interchanged, and null can not be assigned to a Boolean type variable.
Java data types simple to understand