For BE/B.Tech/BCA/MCA/ME/M.Tech Major/Minor Project for CS/IT branch at minimum price Text Message @ 9424820157

Oops Concepts in Java

 Oops Concepts in Java



Basically, there are 4 oops concepts in java, they are :

1) Abstraction
2) Encapsulation
3) Inheritance
4) Polymorphism

Abstraction

When we hide internal functionalities and showing only the outcome of any process/machine, etc is known as abstraction.
example: fan

when we switch on the fan starts moving. however how the fan moves mean working of motor, winding, etc is hidden.

lets again take one common example: mobile phone

When we make any call from mobile or receive any call from the mobile phone at that time we only know the input is coming in the form of voice and we need to reply in the same. but how voice is processing to network and what exactly going on in mobile machinery we don't know.

the same concept applies to the java programming language.
in java, we achieve abstraction by using abstract classes and interfaces.
Abstract classes and interfaces are very important topics that we are going to discuss in our upcoming tutorials.


Encapsulation :

gathering or grouping similar things is known as encapsulation.


Example: a geometry box
in geometry box rounder, divider, protector, etc are together combined to form a fully functional geometry box.

let's see another example from our kitchen: a spices box

in the spices box, there are different divisions one for chilly powder second for coriander powder third for salt, etc. all divisions in a combined form become a spices box.



                        Spices encapsulated in a spices box




Above figure showing encapsulation of different constituents of the same category. 


in java, we can say that the gathering of all data including variables and methods together is known as encapsulation.

the result of encapsulation is a class.


Inheritance

the general meaning of inheritance means something that we got from our predecessors.

for example property of parents is inherited by the child.
obviously, parent's property is inherited by their children.

similarly, in java, the child class gets properties of the parent class called inheritance.
 or, if one class gets properties or behavior of another class is known as inheritance.



inheritance is a very important concept as per the java programming perspective and we will discuss it in detail in our upcoming tutorials.


Polymorphism

it is a Greek word that means multiple forms of a thing/object, etc

example: a boy
a boy can be a brother of someone or he can be a son of someone or grandson of someone or a student of someone. thus boy is a single entity but he is playing different roles.



                   Figure showing boy is playing different roles 

let's take another example: turmeric
turmeric is a very common spice in India. but apart from its usage as a spice, it is also used in many ayurvedic medicines also it is used for cosmetics. hence, it has multiple forms and uses.



                 Figure showing turmeric is playing different roles 

In java, we can define polymorphism as "one object multiple forms"
or when an object is associated with multiple roles then this phenomenon is known as polymorphism.

this is a very important oops concept and widely used in building applications.







No comments:

Post a Comment



Please go through below tutorials:


Mule 4 Tutorials

DEPLOY TO CLOUDHUB C4E CLIENT ID ENFORCEMENT CUSTOM POLICY RABBIT MQ INTEGRATION
XML TO JSON WEBSERVICE CONSUMER VM CONNECTOR VALIDATION UNTIL SUCCESSFUL
SUB FLOW SET & REMOVE VARIABLE TRANSACTION ID SCATTER GATHER ROUND ROBIN
CONSUME REST WEBSERVICE CRUD OPERATIONS PARSE TEMPLATE OBJECT TO JSON LOAD STATIC RESOURCE
JSON TO XML INVOKE IDEMPOTENT FILTER FOR EACH FLAT TO JSON
FIXWIDTH TO JSON FIRST SUCCESSFUL FILE OPERATIONS EXECUTE ERROR HANDLING
EMAIL FUNCTIONALITY DYNAMIC EVALUATE CUSTOM BUSINESS EVENT CSV TO JSON COPYBOOK TO JSON
CHOICE ASYNC

Widely used Connectors in Mule 3

CMIS JETTY VM CONNECTOR SALESFORCE POP3
JMS TCP/IP WEBSERVICE CONSUMER QUARTZ MONGO DB
FILE CONNECTOR DATABASE CONNECTOR


Widely used Scopes in Mule 3

SUB FLOW REQUEST REPLY PROCESSOR CHAIN FOR EACH CACHE
ASYNC TCP/IP COMPOSITE SOURCE POLL UNTIL SUCCESSFUL
TRANSACTIONAL FLOW

Widely used Components in Mule 3

EXPRESSION CXF SCRIPT RUBY PYTHON
JAVASCRIPT JAVA INVOKE CUSTOM BUSINESS EVENT GROOVY
ECHO LOGGER


Widely used Transformers in Mule 3

MONGO DB XSLT TRANSFORMER REFERENCE SCRIPT RUBY
PYTHON MESSAGE PROPERTIES JAVA TRANSFORMER GZIP COMPRESS/UNCOMPRESS GROOVY
EXPRESSION DOM TO XML STRING VALIDATION COMBINE COLLECTIONS BYTE ARRAY TO STRING
ATTACHMENT TRANSFORMER FILE TO STRING XML TO DOM APPEND STRING JAVASCRIPT
JSON TO JAVA COPYBOOK TO JSON MAP TO JSON JSON TO XML FLATFILE TO JSON
FIXWIDTH TO JSON CSV TO JSON


Widely used Filters in Mule 3

WILDCARD SCHEMA VALIDATION REGEX PAYLOAD OR
NOT MESSAGE PROPERTY MESSAGE IDEMPOTENT FILTER REFERNCE
EXPRESSION EXCEPTION CUSTOM AND


Exception Strategy in Mule 3

REFERENCE EXCEPTION STRATEGY CUSTOM EXCEPTION STRATEGY CHOICE EXCEPTION STRATEGY CATCH EXCEPTION STRATEGY GLOBAL EXCEPTION STRATEGY


Flow Control in Mule 3

CHOICE COLLECTION AGGREGATOR COLLECTION SPLITTER CUSTOM AGGREGATOR FIRST SUCCESSFUL
MESSAGE CHUNK AGGREGATOR MESSAGE CHUNK SPLITTER RESEQUENCER ROUND ROBIN SOAP ROUTER