Principle Oops Concepts

Abstraction refers to the act of representing essential features without including the background details or explanations.

    • Allows to hide non essential & implementation details about an object to reduce complexity & increase efficiency
    • Focuses on the outside view of an object (i.e. the interface)
    • Used in design phase

Encapsulation is a technique used for hiding the properties and behaviors of an object and allowing outside access only as appropriate

    • It prevents other objects from directly altering or accessing the properties or methods of the encapsulated object
    • Focuses on Information Hiding or Data Hiding
    • Used in implementation phase


    • Protection
    • Allows change

Encapsulation is basically the deliverable of Abstraction.

Inheritance is the process by which objects of one class acquire the properties of objects of another class.

    • A class that is inherited is called a superclass
    • The class that does the inheriting is called a subclass
    • Inheritance is done by using the keyword extends
    • The subclass inherits the base class’ data members and member functions
    • The subclass has all data members & member functions of its base-class plus its own


    • To promote code reuse
    • To use polymorphism

Polymorphism is briefly described as “one interface, multiple implementations“.
It allows an entity such as a variable, a function or an object to have more than one form
Java achieves Polymorphism in following ways:

1. Compile time Polymorphism

    • Method overloading – Multiple methods having the same name, but different formal argument lists

2. Runtime Polymorphism

    • Method overriding through inheritance.
    • Method overriding through Java interface – Multiple methods having the same name, same return type and same formal argument list. The determination of the method to be called is based on the object being referred to by the reference variable.