Basic data types of Java learning

Source: Internet
Author: User

Basic data type:

Boolean, only two values, true or FALSE. Used in logic to judge.

Byte, byte type, one byte, -128~127, not commonly used.

Shorter, short integer, two bytes, -2^15~ (2^15-1), not commonly used.

, int, Integer, four bytes, 32bit, common

, long,, length integer,

float, float, low precision (relative to double)

Double, float type, high precision (relative to float)

Char., character type, two bytes

Char can hold an integer value corresponding to the ASCII code, and the output is automatically converted to the corresponding character, or null if there is no corresponding character.

The data type can be automatically converted from low to high, but a high turn low requires forced type conversions, which can be problematic, such as storage size out of bounds.

The above 8 basic types have their corresponding packaging type, in addition to the int corresponding to the Integer,char corresponding character other wrapper class is the first letter uppercase, such as long corresponding to long.

The base type is stored in the stack, and its corresponding wrapper class is an object that is stored in the heap.

Basic data types of Java learning

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.