Data types in Java

Source: Internet
Author: User

The data types in Java are divided into basic data types and reference data types, basically branching structure as follows:

Java Data type:

Basic data type:

Numeric type:

Integer type: Byte:8 bit, data range -128~127, wrapper class: Java.lang.Byte

Short:16 bit, data range -32768~32767, wrapper class: Java.lang.Short

Int:32 bit, data range (negative 2 of 31 square to positive 2 of 31 times minus 1), Packing class: Java.lang.Integer

long:64 bit, data range (negative 2 of 64 square to positive 2 of 64 times minus 1), Packing class: Java.lang.Long

Floating-point type: float:32 bit, data Range ( ieeee 754 single precision ), Wrapper class: Java.lang.Float, the direct assignment must be preceded by a number F or F, the default value is 0.0f/f

double:64 bit, data range ( max. IEEE 754 Double precision ), wrapper class: Java.lang.Double, can be added D or D when assigned, and can not be added, default value 0.0

Non-numeric type:

Character type: char:16 bit, storing Unicode code, assigning value with single quotation mark, wrapper class: Java.lang.Character, when the variable is initialized, the default value is ' u0000 '

Boolean type: Boolean:1 bit, only true and false two states, initialized to False

Reference data type:

Class, interface, array, enumeration,

Data types in Java

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.