Basic Java Essentials Summary of several key keywords (about static, this, final,)

Source: Internet
Author: User

You don't get anythin unless you create an object of the that class with new, and at so point data storage is created and me Thods become available.

But there was and situations in which this approach was not sufficient. One is if you want to has only one picec of storage for a particular piece of data,regardless of what many objects is CRE Ated,or even if no objects is created. The other are if you need a method, that isn ' t associated with any particular object of this class. The above is the "thinking in Java" for What to use the description of the static keyword, translated even based on the following two reasons: 1. You only need to save one copy of the data in memory; 2. You need some data that is not associated with the object.

Of course,since static methods don ' t need any objects to be created before they is used, they cannot directly access non- Static members, or methods by simply calling those, other members, without referring to a named object (since Non-static Membe RS and methods must is tied to a particular object). The sentence translates to a property or method in which the static method cannot be directly non-static.

Basic Java Essentials Summary of several key keywords (about static, this, final,)

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.