Kiran Borge

Jan 08, 2025 • 3 min read

What is oops ?

Oriented Programming Language

Oop's stands for Object Oriented Programming Language . The main purpose of oops is to deal with real world entity using programming languages.

Any programming language that follow and support feautures like Classes, Objects, Inheritance, Polymorphism, Encapsulation, Data Biding, Message Passing and Data Abstraction is called Object Oriendted Programming Language.

The Object Oriented Programming gave a new height of programming by giving the unique way of organizing large complex programs. In Oops we organize a program using two way first is around it's CODE and second is around DATA.

Oops Features

  • Class

  • Object

  • Method

  • Inheritance

  • Polymorphism

  • Encapsulation

  • Abstraction

What is Class ?

Class is collection of objects and it doesn't take any space on memory, class is also called blueprint | logical entity.

Syntax :

class class_name
{
  ---  // Data
  ---  // Method
}

Example :

class Demo
{
 int a = 10; String b ="Kiran";
 void show()
  {
    System.out.print(a+" "+b);
  }
}

What is Objects ?

Object is instance of class, that executes the class. Once object is created, it take a space like other variable in memory.

Syntax :

class-name obj-name = new class-name()

Example :

class Demo // Class
{
    int a=10;
    String = "kiran";
    void show()        // Method
    {
        System.out.print(a+" "+b);
    }
}
class Test              // new class
{
    public static void main(String[] args)
    {
        Demo kiran = new Demo();    // object
        kiran.show();
    }
}

What is Method ?

Method is Group / Block of code, which take input from the user. Method runs only when it called.

> Predefind - Method    

 pritn();
  sqrt();
   
> Userdefind - Method 
 
  add();
  display();

Example :

void display()
{
  ---
}

What is Inheritance ?

When a class derives from another class is called Inheritance. Inheritance is a feature or a process in which, new classes are created form the existing classes. The new class created is called 'derived class' or 'child class' and the existing class is known as the 'base class' or 'parent class'.

One class depends on another class. Reusability - Many time used code.

An inherited class is defined by using the extends keyword.

Example :

class A
{
   --- 
}
class B extends class A
{
   ---
}

What is Polymorphism ?

The word polymorphism means having many forms.

Real-Life : Polymorphism

A person at the same time can have different characteristics. Like a man at the same time is a father, a husband, an employee. So the same person possesses different bahavior in different situaltions. This is called polymorphism.

Example :

man(father);

man(husband);

man(employee);

What is Encapsulation ?

It is used to wrapping data and information under a into single unit is called encapsulation.

What is Abstraction ?

Abstraction means displaying only essentioal information and hiding the details. Data abstraction refers to providing only essential information about the data to the outside world, hiding the background details or implementation.

Example :

Website - only (UI) Front End part visible from the user and all backend part hide from the user.

I hope you understood what is oops ? If you like this article Follow me for such intresting topics and you also learn with me...! #oops

😁 Subscribe - borgetech 😋 Follow - borgetech

Join Kiran on Peerlist!

Join amazing folks like Kiran and thousands of other people in tech.

Create Profile

Join with Kiran’s personal invite link.

0

8

1