Java Knowledge Summary

Source: Internet
Author: User

Object-oriented features

1. Encapsulation

Encapsulation gives an object the ability to hide internal attributes and behaviors. Object provides methods that can be accessed by other objects to modify the
Change the data inside it. In Java, there are 3 modifiers: public, private, and protected. Each modifier
Give different access permissions to other objects that are located in the same package or under different packages.

Some of the benefits of using encapsulation are listed below:

1. protect the state inside the object by hiding the properties of the object.

2. Improves the usability and maintainability of the code, because the behavior of the object can be changed individually or extended.

3. Prohibit undesirable interactions between objects improve modularity

2. Inheritance

Inheriting to an object provides the ability to get fields and methods from subclasses. Inheritance provides the reusability of code, or adds new attributes to existing classes without modifying the class.

3. polymorphic

Polymorphism is the ability of a programming language to present the same interface to different underlying data types. An operation on a polymorphic type can be applied to other types of values.

    

Java Knowledge Summary

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.