Java Oops In Hindi – Java OOPs Concepts In Hindi

Java

Java Oops In Hindi:- Java Object-Oriented Programming Language Hai Or Java OOPs Concepts In Hindi Mai 2 Prakar ke program paradigm ka use Kiya Jata Hai | Yah “Procedure Oriented” Or “Object-oriented programming” Hai | Aaj Ke Time Ki Sabhi programming languages Object-oriented programming Ko Istemal Karti Hai.

Also Read –Java Arrays

Java Oops In Hindi

Java OOPs in Hindi Ek software development paradigm Hai | Joki procedure oriented approach Mai Aane Wale problems Ko solve Karne ke Liye Kiya Jata Hai | 

Java Object-oriented programming, Data ko program development Ke Douran system Mai flow Nhi Hone Deta । Yah Aise Kisi Bhi other function Kai Duvara Achanak change Hone Se Rokta Hai | Isme problem Ko object Ke Duvara solve Kiya Jata Hai | Or Isme data or function object Kai Sath Kaam Karte Hai | object ke data Ko Keval object ka function Hi access kar sakta Hai ।

Python Oops In Hindi

Features of Object-Oriented Programming in Hindi

  • Class
  • Object
  • Method
  • Inheritance
  • Polymorphism
  • Data Abstraction
  • Encapsulation

Niche Diye Gaye Java Object-oriented Support ko Bataya Gaya hai |

Also Read –  HTML Full Course 

Java OOPs Concepts In Hindi

Ab Ham Oops Concepts In Java In Hindi Ko Understand Karte Hain Ek Ek Karke |

Class

Class ek user-defined data type hai | ye C language mei structure ki tarah hi hota hai | lekin classes mei aap variable ke sath sath unse related functions bhi bana sakte hai | jinhe aap bad mei objects ke duvara access kiya ja sakta hai |

Java Me Class Ko Create Karne Ke class keyword Ka Istemal Kiya Jata Hai |

Class Definition Syntax:

public class Main {
  // code goes here...
}

Class Definition Example:

public class Main {
  int x = 15;
}

Objects

Class ek user difined data type hai | Class type ke variables ko objects kaha jata hai |

object creation syntax:

class_name myObj = new class_name();

object creation example:

public class Main {
  int x = 15;

  public static void main(String[] args) {
    Main myObj = new Main();
    System.out.println(myObj.x);
  }
}

Aapko Pta Hoga Ki Hamne Class Main Create Kiya Tha Upper Or Ab Hamne Us Class Ka Ek Main myObj Create Kiya Hai | aap Kitne bhi object create Kar Sakte Hai |

Output:

15

Method

Method Overriding Ye OOP Ka Ek Hissa Hai| Method Overriding Ka Istemal Inheritance Mai Kiya Jata Hai | Isme Ek Hi Name Ke Function Ko Alag Alag Class Mai Alag Alag Definition Di Jati Hai | Method Overriding Mai Function Ko Override Kiya Jata Hai |

Example for Method Overriding

// Create a Main class
public class Main {
 
  // Create a fullThrottle() method
  public void fullThrottle() {
    System.out.println("The car is going as fast as it can!");
  }

  // Create a speed() method and add a parameter
  public void speed(int maxSpeed) {
    System.out.println("Max speed is: " + maxSpeed);
  }

  // Inside main, call the methods on the myCar object
  public static void main(String[] args) {
    Main myCar = new Main();   // Create a myCar object
    myCar.fullThrottle();      // Call the fullThrottle() method
    myCar.speed(200);          // Call the speed() method
  }
}

Output:

The car is going as fast as it can!
Max speed is: 200

Abstraction

Abstraction Means ki end-user ko Wahi functionality show ki Jaye Jiski Usko Jarurat hai | Baki background functionality hide Kar di Jaye |

Encapsulation

Encapsulation ko data hiding Bhi Kahte hai | Sath hi encapsulation Ke duvara data or functions ko outside access se protect Kiya Jata hai | Encapsulation ke 3 types hote hai ( Public, Private, Protected) ka protection provide karti hai |

Inheritance

Inheritance object-oriented programming ka concept hai | Jisme Ek code ko dusri jagah par istemal Kiya ja Sakta hai | ye code re-usability implement Karta hai |

Example:

class Vehicle {
  protected String brand = "Ford";        // Vehicle attribute
  public void honk() {                    // Vehicle method
    System.out.println("Tuut, tuut!");
  }
}

class Car extends Vehicle {
  private String modelName = "Mustang";    // Car attribute
  public static void main(String[] args) {

    // Create a myCar object
    Car myCar = new Car();

    // Call the honk() method (from the Vehicle class) on the myCar object
    myCar.honk();

    // Display the value of the brand attribute (from the Vehicle class) and the value of the modelName from the Car class
    System.out.println(myCar.brand + " " + myCar.modelName);
  }
}

Output:

Tuut, tuut!
Ford Mustang

Polymorphism

Python mei Polymorphism function overloading duvara implement kiya jata hai | jisme ek name ke functions ko alag alag conditions mei execute kiya jata hai |

Example:

class Animal {
  public void animalSound() {
    System.out.println("The animal makes a sound");
  }
}

class Pig extends Animal {
  public void animalSound() {
    System.out.println("The pig says: wee wee");
  }
}

class Dog extends Animal {
  public void animalSound() {
    System.out.println("The dog says: bow wow");
  }
}

class Main {
  public static void main(String[] args) {
    Animal myAnimal = new Animal();  // Create a Animal object
    Animal myPig = new Pig();  // Create a Pig object
    Animal myDog = new Dog();  // Create a Dog object
    myAnimal.animalSound();
    myPig.animalSound();
    myDog.animalSound();
  }
}

Output:

The animal makes a sound
The pig says: wee wee
The dog says: bow wow

Oops In Hindi

Abhi Tak Ham Ne Keval Java Oops Ke Concepts Ko Understand Kiya Hai Inke Har Ek Function Ke Liye Hamne Alag Se Post Publish Kiye Aap Unhe Bhi Read Kar Sakte Hai |

Leave a Reply

Your email address will not be published. Required fields are marked *