DEV Community

Pavithraarunachalam
Pavithraarunachalam

Posted on

Object oriented Programming in java..

Introduction to OOPs in Java:

  • OOPs stands for Object-Oriented Programming System. It is a programming approach based on the concept of "objects", which contain data (variables) and methods (functions).

  • Java is an object-oriented programming language, meaning it follows the OOPs concepts to organize and design software.

Java oops concepts:

Class:

  • In Java, a class is a blueprint or template used to create objects. It defines the state (fields/attributes) and behavior (methods) that the created objects will have.

object:

  • An object is created from a class and holds its own copies of the class’s variables and can call the class’s methods.

Encapsulation:

  • Encapsulation is one of the four fundamental OOP principles in Java . It means wrapping data (variables) and code (methods) together as a single unit — and restricting direct access to some of an object’s components.

Polymorphism:

  • Polymorphism means "many forms." It allows objects to be treated as instances of their parent class, even if they behave differently. It’s a core concept in Object-Oriented Programming, enabling flexibility and reusability.

Inheritance:

  • Inheritance is a core concept in Object-Oriented Programming that allows one class to inherit the properties and behaviors (fields and methods) of another class.

  • It promotes code reuse, hierarchical classification, and extensibility.

Abstraction:

  • Abstraction is an OOP concept that focuses on hiding internal implementation details and only showing the essential features of an object.

  • Think of it like driving a car: You use the steering wheel and pedals without knowing how the engine or transmission actually works.

Top comments (0)