DEV Community

Chithra Priya
Chithra Priya

Posted on • Edited on

I learned today in Java: Class, Object and Basics of OOP concept

What is Class?
Class is a template or blue print.it's group of activity or container.

What is an Object?
Object is a combination of state and behaviour.

What is an OOP?
OOP stands for Object-Oriented Programming Language.

Procedural programming is about writing procedures or methods that perform operations on the data, while object-oriented programming is about creating objects that contain both data and methods.

Advantages of OOP:
OOP is faster and easier to execute
OOP provides a clear structure for the programs
OOP helps to keep the Java code DRY "Don't Repeat Yourself", and makes the code easier to maintain, modify and debug
OOP makes it possible to create full reusable applications with less code and shorter development time.

OOPS Pillars:

Encapsulation:
The meaning of Encapsulation, is to make sure that "sensitive" data is hidden from users. To achieve this, you must:

declare class variables/attributes as private
provide public get and set methods to access and update the value of a private variable.

Inheritance:
An object of one class acting as an object of another class.

Polymorphism:
Polymorphism means "many forms", and it occurs when we have many classes that are related to each other by inheritance.

Abstractions:
Showing only necessary data and hiding unwanted data.

Top comments (0)