Java data types of classification and description

 

 

 

Java data types are stored in memory:

1) storing basic data types Principle: All simple data types are not the concept of "references" the existence of the basic data types are stored directly on the memory stack memory, the data itself value is stored on the stack space inside, and inside the Java language data types are eight kinds of such storage model;

storage principle 2) reference types: reference types inherit from the object class (also a reference type) are in accordance with Java objects stored inside memory model for data storage, the use of Java memory heap and stack memory to perform this type of data storage, put it simply, "reference" is stored in the memory and orderly stack, and the value of the object itself is stored in the memory heap on;

difference: the difference between the basic data and reference types of basic data types are mainly allocated on the stack, and reference types are allocated on the heap

Guess you like

Origin www.cnblogs.com/twuxian/p/11127738.html