Java基本数据类型

1. 整型

    /**
     * A constant holding the minimum value a {@code byte} can
     * have, -2^7.
     */
    public static final byte   MIN_VALUE = -128;
    /**
     * A constant holding the maximum value a {@code byte} can
     * have, (2^7)-1.
     */
    public static final byte   MAX_VALUE = 127;

Java基本数据类型

    /**
     * A constant holding the minimum value a {@code short} can
     * have, -2^15.
     */
    public static final short   MIN_VALUE = -32768;
    /**
     * A constant holding the maximum value a {@code short} can
     * have, (2^15)-1.
     */
    public static final short   MAX_VALUE = 32767;

Java基本数据类型

    /**
     * A constant holding the minimum value an {@code int} can
     * have, -2^31.
     */
    @Native public static final int   MIN_VALUE = 0x80000000;
    /**
     * A constant holding the maximum value an {@code int} can
     * have, (2^31)-1.
     */
    @Native public static final int   MAX_VALUE = 0x7fffffff;
    /**
     * A constant holding the minimum value a {@code long} can
     * have, -2^63.
     */
    @Native public static final long MIN_VALUE = 0x8000000000000000L;
    /**
     * A constant holding the maximum value a {@code long} can
     * have, (2^63)-1.
     */
    @Native public static final long MAX_VALUE = 0x7fffffffffffffffL;

2. 浮点型 (Java中浮点数采用的是IEEE 754标准)

3. char (Java采用的是16位的Unicode字符集)

2字节空间,表示范围\u0000~\uffff

    /**
     * The constant value of this field is the smallest value of type
     * {@code char}, {@code '\u005Cu0000'}.
     *
     * @since   1.0.2
     */
    public static final char MIN_VALUE = '\u0000';
    /**
     * The constant value of this field is the largest value of type
     * {@code char}, {@code '\u005CuFFFF'}.
     *
     * @since   1.0.2
     */
    public static final char MAX_VALUE = '\uFFFF';

4. boolean

2.3.4. The Type boolean
Although the Java Virtual Machine defines a type, it only provides very limited support for it. There are no Java Virtual Machine instructions solely dedicated to operations on values. Instead, expressions in the Java programming language that operate on values are compiled to use values of the Java Virtual Machine data type. booleanbooleanbooleanint
The Java Virtual Machine does directly support arrays. Its newarray instruction (§newarray) enables creation of arrays. Arrays of type are accessed and modified using the array instructions baload and bastore (§baload, §bastore). booleanbooleanbooleanbyte
In Oracle’s Java Virtual Machine implementation, arrays in the Java programming language are encoded as Java Virtual Machine arrays, using 8 bits per element. booleanbyteboolean
The Java Virtual Machine encodes array components using to represent and to represent . Where Java programming language values are mapped by compilers to values of Java Virtual Machine type , the compilers must use the same encoding. boolean1true0falsebooleanint

以上是Oracle发布的《Java虚拟机规范》中关于boolean的解释原文
意思大概是:

待续。。。

发表回复