In Java, data types are divided into basic data types and reference types.
One: Basic type: Int (integer) short (Long Integer) float (floating point) double (double-precision floating point) char (character type) Byte Boolean
4 Integral types
BYTE 1 byte -128--127
Short 2 byte -32,768--32,767
int 4 byte -2,147,483,648--2,147,483,647 (more than 2 billion)
Long 8 byte -9,223,372,036,854,775,808--9,223,372,036854,775,807
Note: The number of bytes occupied by all data classes in Java is platform-independent, and Java does not have any unsigned types
Two, 2 types of floating-point
Float 4 byte 32-bit IEEE 754 single precision (significant bit 6–7 bit)
Double 8 bytes 64-bit IEEE 754 double precision (15 bits of significant digits)
Three, 1 types of Unicode encoded character units
Char 2 byte entire Unicode character set
Four, 1 kinds of truth types
Boolean 1 bit True or false
reference type: Except for variables of the underlying data type above, the rest are all reference data types;
3 Types of references
first, class reference
can be created by us, I don't speak much here, mainly to explain the classes in several Java libraries
Object:object is a very important class, object is the root class of the class hierarchy, each class uses object as the superclass, and all objects (including the number
groups) Implement this class of methods. Use object to define all classes
Object object= New Integer (1) to define a Interger class
integer i= (integer) object; In order to cast this object into the Interger class
The String:string class represents a string, and all string literals (such as "ABC") in a Java program are implemented as instances of this class. Check the order of the sequence
characters, compare strings, search strings, extract substrings, create a copy of a string, and in that copy all characters are converted to uppercase or lowercase.
Date:date represents a specific moment, accurate to milliseconds. The classes of date are generally now replaced by calendar and GregorianCalendar.
The Void:void class is a non-instantiated placeholder class that maintains a reference to a class object that represents the Java keyword Void.
also has a corresponding class such as: Integer Long Boolean Byte Character Double Float Short
Data type in Java 2017-09-09