Java Virtual Machine Specification read notes-data type JVM data type 1. Overview
The data types of Java virtual machines can be divided into two main classes: primitive types (Primitive Types, also known as base types) and reference types (Reference Types).
Java Virtual machines use different bytecode directives to manipulate different data types.
2. Original type
Primitive types are the most basic elements that make up complex reference types. Like everything else in the world, it is composed of the most basic chemical elements.
Primitive types are divided into three categories: numeric types (Numberic Types), Boolean types (Boolean type), ReturnAddress types, and numeric types that can be refined to integer (Integral Types) and floating-point (floating-point Types).
Integral type
-
Byte:8-bit signed twos complement integer, value range [ -27,27-1], default value is zero;
-
SHORT:16-bit signed twos complement integer, value range [ -215,215-1], default value is zero;
-
INT:32-bit signed twos complement integer, value range [ -231,231-1], default value is zero;
-
LONG:64-bit signed twos complement integer, value range [ -263,263-1], default value is zero;
-
Char:16-bit unsigned UTF-16 encoded Unicode value, value range [0,65535] The default value is null (' \u0000 ');
Floating point Type
-
Float:32 bit single-precision floating-point number set, the default is positive 0;
-
double:64-bit double-precision floating-point number set, the default value is positive 0;
Boolean type
ReturnAddress type
Reference type
Java Virtual machines have three reference types: class Types, array type (array Types), interface type (Interface Types), which are created dynamically by class instances, array instances, and class instances or array instances that implement an interface. In addition, there is a special value null, which does not point to any object, the value of the reference type is NULL, and NULL is also the default value of the reference type.
For an array type, it also contains the component type of a single dimension (Component type), which can be an array, an original type, a class type, or an interface type. When the component type is an array type, the component type of the array continues to be repeated, and the last layer of the component type must be a non-array, which is also the element type of the array type. This is also the implementation form of multidimensional arrays.
-
Operations involving Boolean values in the Java language are replaced with the Int (32 bit) data type of the Java Virtual machine after compilation, and the access of the Boolean array type has a byte code directive that modifies an array of byte (8-bit) types.
Java Virtual Machine Specification read notes-data types