Home  >  Article  >  Java  >  java-object-oriented features

java-object-oriented features

怪我咯
怪我咯Original
2017-06-26 11:13:241175browse

Encapsulation: refers to hiding the properties and implementation details of an object and only providing public access methods to the outside world.

Benefits:

1. Hide implementation details and provide public access.

2. Improved code reusability.

3. Improved security.

Principles of Encapsulation:

1. Hide content that does not need to be provided to the outside world.

2. Hide the properties and provide public methods to access them.

this: is the object reference of the current class. That is: it represents an object of the current class.

This application scenario;

Solution to local variables and hidden member variables.

The above is the detailed content of java-object-oriented features. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn