Java thousands of questions _06 data structure (001) _java What is the type __java data type

Source: Internet
Author: User

Click to enter _ more _java thousand ask 1, what is the data type

The Java language is statically typed (statical typed), in other words, the type of all variables and expressions is completely determined when compiled. Because it is statical typed, the Java language is also strongly typed (strong typed).
A strong type means that each variable has a type, and each type is strictly defined (of course generics are special, see here: What generics are), the type limits what values the variable can assign, and what the expression ultimately produces. It also limits the types of operations that these values can perform and the specific methods. All assignment operations, whether explicit or passed through parameters in a method call, are checked for type compatibility.
The types mentioned here can be the 8 basic types provided by Java (primitive type), or other class types in Java (also referred to as reference types reference to object, including, of course, the more specific string, Array, collection type) and the custom class type. Each class type is composed of several basic types, which are eventually stored in the heap.
Understand 8 basic data types: What are the 8 basic data types in Java?
Understand the Java memory stack look here: 2. How basic data types and class types are stored

First, the base data type stores the value in the stack (directly contain value), and the class type Object (which consists of several basic data types) is stored in the heap and the logical address of the heap is stored on the stack. are value-passing (reference passing is pseudo concept, understanding reference passing and value passing to see here: What is the difference between reference passing and value passing).

Second, get the basic data type directly from the stack, and get class-type objects need to get the heap logical address in the stack, and then go to the heap based on this address to get.

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.