Characteristics of OOP in JAVA

Characteristics of OOP in JAVA

What are the Concept of oops in JAVA ?

  • Objects
  • Classes
  • Inheritance
  • Encapsulation
  • Data abstraction
  • Polymorphism












Object

An object has states(properties) and behavior (set of tasks performed by an object).Any real world entity like  a chair, pen, table, keyboard, bike, etc. It can be physical or logical.

What is Class and Object in Java OOPS?
Example
A dog is an object because ithas states like color, name, breed etc.as well as behaviors like wagging the tail, barking, eating, etc.

Class

Blueprint of an object.A class can have multiple objects.It is a logical entity.
Example:
 A student class can have many objects like student1,student2,student3 etc.

Inheritance

When one 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.

Encapsulation

Binding (or wrapping) code and data together into a single unit are known as encapsulation.

  
                              Encapsulation in Java | Realtime Examples & Advantages - Scientech ...


Example:
  A capsule, it is wrapped with different medicines.

Data Abstraction

Hiding internal details and showing functionality is known as abstraction.In Java, we use abstract class and interface to achieve abstraction.

How ATMs determine which denominations to dispense
How to Block Caller ID on Your Phone - Techlicious

Example :
phone call, we don't know the internal processing and ATM don't show the internal processing.

Polymorphism

If one task is performed in different ways, it is known as polymorphism. In Java, we use method overloading and method overriding to achieve polymorphism.


Example:
to draw polygon can be anything like draw triangle, draw rectangle, draw square etc.





More will come idea if you watch this video:-






Post a Comment

0 Comments