Java Basic knowledge data type

Source: Internet
Author: User

Basic data types

The base types can be divided into three categories, char types, Boolean type Boolean, and numeric type Byte, short, int, long, float, double.

There are no unsigned numeric types in Java, and their range is fixed and will not change with the machine hardware environment or the operating system.

We do not need to force memory for the range of values of the base types of numeric types, because their values are already defined in the corresponding wrapper class as constants.

The default value is 0,boolean type the default value is False, but its number of bytes is unknown.

Basic type:Byte Number of binary digits:8Packing class:Java.Lang.ByteMinimum value:Byte.Min_value=-128 ( -2^7)Maximum value:Byte.Max_value=127(2^7-1)Basic type:Short Number of binary digits:16Packing class:Java.Lang.ShortMinimum value:Short.Min_value=-32768Maximum value:Short.Max_value=32767Basic type:Int Number of binary digits:32Packing class:Java.Lang.IntegerMinimum value:Integer.Min_value=-2147483648Maximum value:Integer.Max_value=2147483647Basic type:Long Number of binary digits:64Packing class:Java.Lang.LongMinimum value:Long.Min_value=-9223372036854775808Maximum value:Long.Max_value=9223372036854775807Basic type:Float Number of binary digits:32Packing class:Java.Lang.FloatMinimum value:Float.Min_value=1.4E-45Maximum value:Float.Max_value=3.4028235E38Basic type:Double Number of binary digits:64Packing class:Java.Lang.Double minimum: double.=4.9e-324 Max: double.=1.7976931348623157e308 basic type: Span class= "KWD" >char  bits number: 16 wrapper class: java.. Character minimum: character.=0 Maximum value: character.max_value=65535         

In fact, there is another primitive type Void in Java, which also has a corresponding wrapper class java.lang.Void, but we cannot manipulate them directly.

Reference type
    • In Java, a variable of a reference type is very similar to a C + + pointer. A reference type points to an object, and a variable that points to an object is a reference variable. These variables are specified as a specific type at the time of declaration. Once a variable is declared, the type cannot be changed.
    • objects, arrays are reference data types.
    • The default value for all reference types is null.
    • A reference variable can be used to reference any type that is compatible with it.

Java Basic knowledge data type

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.