Object Oriented Programming

Object Oriented Programming (OOP) is a paradigm or methodology based on Objects. It provides some concepts as below:

  • Object
  • Class
  • Polymorphism
  • Inheritance
  • Encapsulation
  • Abstraction

Programming languages that follow these concepts are called object oriented programming languages.


An object is a real life entity that has state (variables) and behavior (methods). e.g. A dog has states like color,breed,name etc. and behaviors such as barking, running etc.

In other words, object is an instance of class.


A class is a blueprint or template which tells what states and behavior an object of it's type will possess.


Poly means many and morphism means form, hence polymorphism means many forms. Polymorphism in Java is achieved by method overloading and methods overriding, where methods with same name performs different tasks.


Inheritance allows a child class to use properties and methods of parent class. Inheritance provides code reusability.


Encapsulation is wrapping the data (variables) and methods together as a single unit. In Java encapsulation is achieved by using class and access modifiers.


Hiding the internal details and showing only functionalities is called abstraction. For example, while driving a car we only use functionalities provided by car, we don't bother about internal working of car.

In Java abstraction is achieved by using abstract class and interface.

Pure Object Oriented Language

A pure object oriented language is a language where all data types (user defined and predefined) are objects. Java is object oriented but not a pure object oriented language because it supports primitive data types (int, char, float etc) which are not an object.

The first pure OOP language is smalltalk