Java programming idea-—— static keyword

Source: Internet
Author: User

For Java, when you create a class, you are describing the appearance and behavior of the object of that class. Unless you create the object of that class with new, you do not actually get any objects. When the new operation is performed, the data storage space is allocated and the method is called by the outside world.

1. What is the static keyword

The static keyword identifies variables and methods that only allocate a single storage space. Don't think about how many objects to create, or even create objects at all. objects or methods that do not create objects can also access static tags.

For static tagged objects, you can manipulate them with objects, or you can manipulate them with classes.

2, some use of static.

For a method of a static tag, you can access only the static tagged object if you want to access the variable in the object.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Java programming idea-—— static keyword

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.