Basic data types and reference data types for Java

Source: Internet
Author: User

Java Data type diagram:
┏ numeric ━┳━ integer type: byte short int long
┏ basic Data type ━━┫ ┗━ floating-point type: float double
┃ ┣ character type: Char
Data type ╋ ┗ Boolean: Boolean
┃ ┏ Classes (Class)
┗ Reference data Type ━━╋ Interface (interface)
┗ Arrays (Array)
Java data types are divided into basic data types (raw data types) and reference data types;
1. The basic eight categories, can be clearly seen in the figure; This type of data variable is immediately allocated to his memory space after the declaration. such as: short A; Java will look for a two-byte block to the A variable in the available memory space;
2. Reference data type in the three kinds of pointers, such as C + +, which point to the object entity in a special way (the specific value), such variables are not allocated memory when declaring, just store a memory address, want to know exactly what to look at the data structure is good.

Popular speaking, one, remember very enough; two, say the memory, talk about the address is basically refers to the reference rather than the basic; three, you can understand the memory address is your study number, and the object entity is you, every time you find through the study number, this is the reference;

The application of this knowledge point:
1. "= =" function in the reference data type, determine whether the memory address is equal, want to judge the content entity with equals;
2, the basic transmission of the value of the transfer is a copy, the original value is unchanged after the change, the reference value of the pass-through is the address, modified the original value changes.

Basic data types and reference 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.