Java data Types
The data types in Java can be divided into two categories, reference types (reference types), and basic types (primitive types), with reference to the most recent definition of the Java Official document drawing type diagram below
Summarize the points I think are important in each of these types
Basic type (primitive types)
- Integer: Used to denote a number without a mouse part, allowed to be negative, usually the most common type of int, byte and short are mainly used for the underlying file processing
- The scope of an integral type in Java is independent of the Java Code's operation
- Long-shaped suffix l or l; hexadecimal value has a prefix of 0x or 0X; octal has a prefix, starting with Java7 prefix 0b or 0B to write binary numbers
- Java does not have any unsigned unsigned form of int,long,short,byte type, Java practices increase the platform can be executed but sacrificing performance
- The char type is originally used to represent a single character, and now the Unicode character may be a char value or two
- Floating point: Floating-point types have two double and float,double (64-bit) numeric precision is twice times the value of float (32-bit), most applications use the float
- FLOAT: Storage requirements 4 bytes, value range: ±3.40282347e+38f, 6-7 digits of effective digits
- Double: Storage requirement 8 bytes, value range approximately ±1.79769313486231570e+308 significant number of digits is 15 bits
- Operation symbols for integral type
- NullPointerException exception is thrown when unpacking a null reference
- ArithmeticException exceptions are thrown when using 0 as the denominator for division operations
- OutOfMemoryError exceptions may be thrown when using the ++,--operator
- operator of floating-point type
- When the two-dollar operator has at least one object that is a floating-point number, a floating-point operation is performed
- If at least one of the two-dollar operators is a double, the 64-bit operation is performed, and the value is first promoted when the other object is not a double
- Any value of a floating-point type can be converted to any number type, but there is no forced type conversion between Boolean
- NullPointerException exception is thrown when unpacking a null reference
- OutOfMemoryError exceptions may be thrown when using the ++,--operator
Java Data types