Java OOP – Abstraction
August 19, 2020 2 min read

Abstraction is a basic concept of OOP which is displaying the essential details to the user by handling the complexity. It is the process of identifying the required characteristics of an object ignoring the irrelevant details.
- You can visit the other concepts Inheritance, Polymorphism and Encapsulation if you guys need to know about them.
Abstraction in the real world:
In day to day life you guys use to watch the television by using remote to handle the channels and other settings. But you don’t know what is the process happening inside the remote or the television. You don’t need to know it. You only need to know how to use the remote and television. This is what abstraction is.
In OOP also You just interact with a simple interface that doesn’t require any knowledge about the internal implementation.
Let’s see what are the cases we should consider when using abstraction.
Case I
If there is no body, method should be abstract.

Case II
If there is an abstract method inside the class, that class should be abstract.

Case III
There is no body for abstract method.

Case IV
There can be many methods inside an abstract class.

Case V
There can be methods which are not abstract, inside an abstract class.

Case VI
There can be only non abstract methods inside an abstract class.

Case VII
If a super class is an abstract class, all the non abstract sub classes that extends the super class should be override the abstract methods of super class.

Case VIII
We can make references from abstract class name. But we cannot make objects from the abstract class name.

Case IX
We can implement polymorphism from the abstract classes and methods.

Case X
Attributes inside an abstract class are not abstract.

Case XI
Constructors inside an abstract class are not abstract.

Case XII
We can’t use static, private and final methods inside an abstract class.

We just finished the discussion of Java OOP four main concepts now. They are Inheritance, Polymorphism and Encapsulation and Abstraction. Let’s discuss about the Java Interfaces from the next article.
Thank you.


