---
title: "Abstraction with example"  
description: "ABSTRACATION It is a process of hiding internal details and showing only relevant data to the object. For implementing it we have to use abstract cla"  
author: "Anonymous User"  
published: 2018-08-30  
updated: 2018-08-30  
canonical: https://www.mindstick.com/blog/11948/abstraction-with-example  
category: "java"  
tags: ["java"]  
reading_time: 2 minutes  

---

# Abstraction with example

## ABSTRACATION

It is a process of hiding internal details and showing only relevant data to the object. For implementing it we have to use [abstract classes and interfaces](https://www.mindstick.com/forum/158922/describe-the-difference-between-abstract-classes-and-interfaces-in-c-sharp).

Suppose we have a record of the employee in a company as given below

• [Full name](https://www.mindstick.com/interview/33973/how-to-split-the-full-name-into-firstname-and-lastname-in-sql-server)

• Employee ID

• Address

• Contact number

• Hobbies

• Favorite book etc.

We need to select only [relevant information](https://answers.mindstick.com/qa/105781/how-to-interpret-financial-news-and-filter-relevant-information-for-investing) of employee like

• Full name

• Employee ID

• Address

• Contact number

Since we fetched only selected information this is called Abstraction.

Same extracted information from a data can be used for other [applications](https://www.mindstick.com/articles/12847/how-to-choose-the-right-ethernet-cable-for-industrial-applications) also e.g. banking application, job portal application etc. with little or no modification. Hence it becomes your master data.

Example: Sending SMS in which you just type the message you need to worry about other processing of message delivery.

It can be achieved using an [abstract class](https://www.mindstick.com/articles/1430/abstract-class) and [abstract method](https://www.mindstick.com/articles/23305/abstract-methods-and-class-in-c-sharp) in java.

## Abstract class:

A class which is declared abstract it may or may not contain [abstract methods](https://www.mindstick.com/forum/159550/how-to-implement-an-interface-with-two-abstract-methods-by-a-lambda-expression).it cannot be instantiated.

## Abstract Method:

A method without a body is [known as](https://answers.mindstick.com/qa/35703/ricky-ponting-is-also-known-as-what) an abstract method.it must be declared in the abstract class. It should not be final.

## Advantages of abstraction:

• It reduces the complexity of the design and [implementation](https://www.mindstick.com/forum/33764/how-to-implementation-of-class-in-c-sharp) process of software.

• It allows you to group several relatable classes as siblings

\

---

Original Source: https://www.mindstick.com/blog/11948/abstraction-with-example

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
