Home > Java > Javagetting Started > What type is string in java

What type is string in java

(*-*)浩
Release: 2019-11-14 14:16:57
Original
5919 people have browsed it

What type is string in java

(1) First give the classification of data types  (Recommended learning: java course)

What type is string in java

(2) Storage of Java data types in memory:

1) Storage principle of basic data types: All simple data types do not have "references" Concept, basic data types are stored directly on the memory stack in the memory. The value of the data itself is stored in the stack space, and the eight data types in the Java language have this storage model;

2 ) Storage principle of reference types: Reference types inherit from the Object class (also reference types) and all data are stored according to the memory model of storing objects in Java. This type of data is stored using the Java memory heap and memory stack. Data storage, simply put, "references" are stored on the ordered memory stack, while the value of the object itself is stored on the memory heap;

Difference:

The difference between basic data types and reference types is mainly that basic data types are allocated on the stack, while reference types are allocated on the heap (requires the concepts of stack and heap in Java)

(3) What data type does string belong to in Java?

#String in Java is a reference data type because String is a class.

The above is the detailed content of What type is string in java. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template