Java, Programming Tutorial

Understanding abstraction in java

In computer science, abstraction is the process by which data and programs are defined with a representation similar in form to its meaning (semantics), while hiding away the implementation details.

Source : WikiPedia

abstraction – a concept or idea not associated with any specific instance.


  • What is abstraction
  • Types of abstraction
  • How to use abstraction in java

What is abstraction

In simple words: “Abstraction captures only those details about an object that are relevant to the current perspective.”

In object-oriented programming theory, abstraction involves the facility to define objects that represent abstract “actors” that can perform work, report on and change their state, and “communicate” with other objects in the system.

Abstraction in any programming language works in many ways. It can be seen from creating subroutines to defining interfaces for making low level language calls. Some abstractions try to limit the breadth of concepts a programmer needs, by completely hiding the abstractions they in turn are built on, e.g. design patterns.

Types of abstraction

Typically abstraction can be seen in two ways:

1) Data abstraction

Data abstraction is the way to create complex data types and exposing only meaningful operations to interact with data type, where as hiding all the implementation details from outside works.

Benefit of this approach involves capability of improving the implementation over time e.g. solving performance issues is any. The idea is that such changes are not supposed to have any impact on client code, since they involve no difference in the abstract behavior.

2) Control abstraction

A software is essentially a collection of numerous statements written in any programming language. Most of the times, statement are similar and repeated over places multiple times.

Control abstraction is the process of identifying all such statements and expose them as a unit of work. We normally use this feature when we create a function to perform any work.

How to use abstraction in java

As abstraction is one of core principles of Object oriented programming practices, and Java following all OOPs principles, abstraction is one of major building block of java language.

Data abstraction spans from creating simple data objects to complex collection implementations such as HashMap or HashSet. Similarly, control abstraction can be seen from defining simple function calls to complete open source frameworks. control abstraction is main force behind structured programming.

Most discussed topics regarding abstraction in java includes abstract classes and interfaces.

Happy Learning !!

From howtodoinjava


1 thought on “Understanding abstraction in java”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s