Showing posts with label Encapsulation. Show all posts
Showing posts with label Encapsulation. Show all posts

Saturday, January 16, 2021

Software Programming

OOPS Concepts


Object-oriented programming System(OOPs) is a programming paradigm based on the concept of “objects” that contain data and methods. 

The primary purpose of object-oriented programming is to increase the flexibility and maintainability of programs. 

Object oriented programming brings together data and its behavior (methods) in a single location(object) makes it easier to understand how a program works. 

Principles of OOPS

They are an abstraction, encapsulationinheritance, and polymorphism


Abstraction is a process where you show only “relevant” data and “hide” unnecessary details of an object from the user. For example, when you login to your bank account online, you enter your user_id and password and press login, what happens when you press login, how the input data sent to server, how it gets verified is all abstracted away from the you.

Encapsulation is one of the best Java OOPs concepts of wrapping the

data and code. In this OOPs concept, the variables of a class are always hidden from other classes. It can only be accessed using the methods of their current class. For example - in school, a student cannot exist without a class.

Inheritance is one of the Basic Concepts of OOPs in which one object acquires the properties and

behaviors of the parent object. It’s creating a parent-child relationship between two classes. It offers robust and natural mechanism for organizing and structure of any software.

Polymorphism is the concept where an object behaves differently in different situations. There are two types of polymorphism – compile time polymorphism and runtime polymorphism.

Compile time polymorphism is achieved by method overloading.


Runtime polymorphism is implemented when we have “IS-A” relationship between objects. This is also called as method overriding because subclass has to override the superclass method for runtime polymorphism.

Advantages of OOPS

  • OOP offers easy to understand and a clear modular structure for programs.
  • It also enhances program modularity because every object exists independently.
  • OOP is faster and easier to execute
  • OOP makes it possible to create full reusable applications with less code and shorter development time