Java class, assigning a variable a small detail, and the meaning of a static callout variable

Source: Internet
Author: User

In the Java class, the variables defined outside the method, if the definition is not assigned, then the method can not be assigned to it, or error, can only be placed in a method to assign its value. (Why do you want to find out later?)

The variable of the static dimension is called a static variable, and when the class is instantiated by the system once, the system will give the static variable a single piece of memory space, that is, the static variable is not dependent on the instance, can be modified by any instance of the class, use.

A counter that can be used as the number of instances of a class, because the variable is reinitialized not every time a new instance is created, regardless of the instance.

Java class, assigning a variable a small detail, and the meaning of a static callout variable

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.