Data types for Java

Source: Internet
Author: User

Data types for Java

First, the underlying data type:

It is divided into numerical, character and Boolean types.

Where: Numerical type is divided into integral type, floating point type

Integer: int, accounting for four bytes

Short

Long

Byte

Float type: float: 4 bytes (Float a = 185.2f;)

Double: occupies 8 bytes

Character type: Char: 2 bytes (char a = ' a ';)

Boolean: Boolean: 1 bytes

II. Reference data types

The difference between a reference data type and a base data type is that the reference type stores the address of the referenced object in memory, and the data type is the data;

So comparisons between data types are equal with = =, whereas reference types are best used equals () to compare the actual values of two objects for equality

Common reference data types are classes, interfaces, and arrays, and so on;

The most common is probably a String.

Data types for 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.