Java variables in-depth understanding

Source: Internet
Author: User

4, variable: In fact, is a storage space in memory, used to store constant data.

Function: Convenient for operation. Because some data is uncertain. So determine the noun and storage space for the data.

Features: Variable space can be reused.

When do I define a variable? as long as the data is uncertain, the variable is defined.

What are the necessary elements for the opening of variable spaces?

1, what data does this space store? The data type.

2, what's the name of this space? The variable name.

3, what is the first data for this space? The initialization value of the variable.

Scope and lifetime of variables :

Scope of the variable :

The scope starts at the position defined by the variable and ends with the curly brace where the variable is located;

Life cycle:

The variable is alive in memory starting at the defined position;

when a variable reaches its scope, it disappears in memory;

Java variables in-depth understanding

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.