OOPs Concept in Java: Basic Terminology

Beginners Code Computer Skills Java Mobile Development

From the article “Java – Overview, Applications, and Features”, we already know Java supports object-oriented concepts. In this article, we will discuss the basic terminologies of OOPs such as inheritance, polymorphism, data abstraction.

In an object-oriented programming language, generally, the focus is on the objects we want to manipulate and not on the logic required to manipulate the objects or data.

The first step in OOPs is to identify the data or objects on which we want to work on and finding the relationship between those objects.

The data variables and methods present in class help to manipulate those objects.

Basic Terminology in OOPs:

  1. Inheritance:

  • This is the concept of OOPs where the characteristics of one class are passed on to another class.
  • It groups or categorizes classes through a parent-child relationship.
  • The child class will inherit all the properties, data and method of the parent class as well as have some new properties of its own.
  • For Example, suppose Animals is the parent class. Let Dog class and Cat class be its child classes. We all know that Dog and Cat exhibit all the characteristics of class Animals and still have some additional characteristics of their own.
  • Private properties of the base or parent class are not inherited by the child class.
  1. Polymorphism:

  • Polymorphism is a Greek word where:
    • Poly means many.
    • Morph means form.
  • Polymorphism means “multiple forms”. Sometimes a single entity behaves in different ways in different situations. This is the concept of Polymorphism.
  • In a real-life scenario, a woman can have a different role in different situations. She may be a daughter, a wife, a sister and a mother at the same time but depending upon the situation.
  • Similarly, in programs, a single method can behave differently for different implementations through method overloading and method overriding.
  1. Data Abstraction:

  • Data Abstraction is the mechanism of retrieving only the essential details that are useful in problem-solving without dealing with background details or any non-essential characteristics.
  • It can be seen as a simplified representation of reality.
  • For example, a map is an abstraction of its complex model. For instance, we have different types of map like a political map, a topographic map, geographical map, etc. A political map only shows the political boundaries of countries and states and adding details such as terrain, minerals will lead to confusion.
  • It emphasizes on the outside view of the objects and the user need not know the inner complex implementation details.
  • Abstraction also focuses on the characteristics and behavior relative to the perspective of the viewer. A different viewer would perceive different characteristics and behavior of the same object.
  • For example, consider the case of a woman, a doctor sees a woman as a patient, a teacher sees her as a student and her parents see her as their child.
  1. Data Encapsulation:

  • The word “ Data Encapsulation”  as per the dictionary means “to place in or as if in a capsule”.
  • Encapsulation is the ability to package data, related behavior in an object bundle. It is all about stuffing data together.
  • Data Encapsulation does not hide the details of the object. It just keeps data variables and methods together inside an object bundle. The data variables describe the state of object and methods describe behavior.
  • Thus this concept binds the state and behavior together inside an object.
  1. Information Hiding:

  • Information Hiding is the process of hiding all the secrets of an object that do not contribute to its essential characteristics.
  • Typically it hides the structure of the object as well as the implementation of its methods.
  • In programming implementation, it is the technique of making the fields and methods in a class as private and providing implementation access through public methods.
  • If a field is private, then it cannot be accessed by anyone outside the class, thereby hiding the fields within the class.

Difference between Data Encapsulation and Information Hiding:

Let us take the example of vitamin capsules.

  • Multivitamin supplements are available in capsule form. Clearly, all the ingredients like Vitamins A, B, B complex, C, K, and other supplements are placed together in a capsule. This packaging structure is similar to Encapsulation.
  • We have seen capsules that have an entirely opaque outer shell. This effectively hides all the ingredients of the multivitamin supplement. This opaque covering ensures Information Hiding.
  • But also there are capsules that have a translucent or transparent cover. Through this, one can see the inner ingredients clearly. Here the object has Encapsulation but there is no Information Hiding.
  • Thus Information Hiding is the method that decides what contents to hide and what items to reveal for the “encapsulated object”.


oops - data encapsulation          oops - data encapsulation


In the next article, I will discuss the most important concept of Object Oriented Programming i.e Inheritance.