OOPs Concepts in Java

Object-Oriented Programming System (OOPs) is a methodology to represent real-world entities into programming. Many programming languages follow OOPs principles, including C++, Java, PHP, C#, and Python. Java supports all OOPs principles except multiple inheritance.

Concepts of OOPs:

  1. Class
  2. Object
  3. Inheritance
  4. Abstraction
  5. Encapsulation
  6. Polymorphism


Class defined as a blueprint for an object. We can create as many Objects for a class. It is often referred to as a template to create an object. Java allows a programmer to create your type using classes. In java String is not a primitive data-type it is class.


An object defined as an instance of the class. The object was having two characteristics states (attributes) and behaviours
If you consider a dog is an object. The states or attributes of the dog are Breed, Age, and Color. Behaviours are Eat, Sleep, and Bark.


Inheritance means acquiring the properties and behaviours of another class. It is one of the key features of OOPs (Object Oriented Programming System). By using inheritance, we can reuse the attributes and methods from other classes (superclass).


Abstraction is the process of showing what is essential to the user and hiding all non-essential details. In java, we can implement the abstraction using Abstract classes and Interfaces.


Encapsulation means binding the states (attribute) and behaviours (methods) in a single unit. Class is the best example of Encapsulation in java. In java, Encapsulation is achieved by making fields as private and providing access to them via public methods. Getter and Setter's methods used for this purpose.


The dictionary meaning for the word "Poly" is many, and "morphs" means forms. In OOPs polymorphism means have many ways. Method overriding is the best example of polymorphism in java.

Post a Comment