Java Virtual Machine Specification read notes-data types

Source: Internet
Author: User

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
    • Boolean [1]: The value range [True,false], the default value is false;

ReturnAddress type
    • ReturnAddress [^2]: An opcode that represents a bytecode instruction, only the ReturnAddress type in the original type supported by the JVM cannot directly correspond to the data type of the Java language.

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.

    1. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.