OOPS
OOPS is stand for Object-Oriented Programming System. Object means a real-life entity such as a pen, chair, computer, tablet, watch, etc. Object-Oriented Programming is a methodology or paradigm to design a program using classes and objects.
The main aim of Object-Oriented programming is to implement real-world entities
for example : Object, classes, abstraction, inheritance, polymorphism, etc.
Object :
An entity that has a state and behavior is known as an object.
for example : pen, chair, table, keyboard, etc.
it can be physical and logical.
Class :
The collection of objects is called class. It is a logical entity.
A class can also be defined as a blueprint from which you can
create an individual object. Class doesn't consume any space.
Inheritance :
When an object acquires all the properties and behaviors of a parent object, it is known as inheritance. It provides code reusability. It is used to achieve runtime polymorphism.
Polymorphism :
If one task is performed in different ways, it is known as polymorphism.
for example: to convince the customer differently, to draw something, for example,
shape, triangle, rectangle, etc.
In java, we use method overloading and method overriding to achieve polymorphism.
Abstraction :
Hiding internal details and showing functionality is known as abstraction.
for example : Phone calls we don't know about internal processing.
In java, we use abstract class and interface to achieve abstraction.
Encapsulation :
Binding or wrapping code and data together into a single unit are known as encapsulation.
for example : a capsule, it is wrapped with different medicines.
A java class is an example of encapsulation. Java bean is the fully encapsulated class because all the data members are private here.
No comments:
Post a Comment