java--Object-Oriented---access properties

Source: Internet
Author: User

The first section of the

private--can only be used for member variables and member functions (restricted to classes, not objects), that is, variables defined as private can only be accessed in this class

public--

protected--

Section II

Package

Section III

Class variable--static

Variables that are defined as static types are variables that belong to the entire class, not to an object, and can be accessed through the class name when you access a variable of this static type. Access by the name of the object, or by the name of the variable.

If you access and modify the value of a variable by the name of the object, the class variable is modified to access the class variable by the name of the other object. The variable name will only get the value after it has been modified.

java--Object-Oriented---access properties

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.