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