Data hiding /abstraction: is the ability of objects to shield variables from external access. It is a useful consequence of the encapsulation principle. Java implements this by the use of access specifiers, namely public, private, protected, and default.2. Inheritance is the process by which one object acquires the properties of another object. The concept of inheritance greatly enhances code reuse and makes hierarchical classification possible. Java implements this by the ability of classes to inherit methods and variables from parent classes and interfaces.
3. Polymorphism (from the Greek, meaning “many forms”) is the ability of a single entity to take multiple forms.
Java implements this by:
• Method Overloading (Methods with the same name but different signatures)
• Method Overriding (Methods with the same name & same signature but one in the parent class and the other in the child class)
• Dynamic Method Dispatch (The mechanism by which a call to an overridden method is resolved at run time, rather than compile time.)
No comments:
Post a Comment