July 17 2026
Abstraction:
Abstraction in Java is the core Object-Oriented Programming (OOP) process of hiding internal implementation details and showing only the essential function to the user.
Real-world example:
TV remote control: You press the power button to turn it ON,
But you do not need to understand the internal circuitry or single transmission to make it happen.
How to Achieve Abstraction in Java
Java provides two mechanisms to implement abstraction:
1. Abstract Classes (0% to 100% Abstraction)
Abstract methods: Methods declared without a body (no curly braces, end with a semicolon).
TV (Super class)
I. Can't use the Abstract method. This error comes.
error: missing method body, or declare abstract
public void powerOn();
II. One or more methods in the abstract class are not abstract and do not override the abstract method
error: TV is not abstract and does not override abstract method powerOn() in TV
public class TV{
^
III. We can't create an object in the main method because it is an empty method.
error: TV is abstract; cannot be instantiated
TV tv = new TV();
^
Remote (Sub class)
IV. The error "Remote is not abstract and does not override abstract method powerOn() in TV".
Superclass abstract subclass also changes the abstract method.
Method value is decided, no more use abstract.
error: Remote is not abstract and does not override abstract method powerOn() in TV
public class Remote extends TV{
^
V. Same for again now Remote class is abstract can't creater object.
error: Remote is abstract; cannot be instantiated
Remote ch =new Remote();
Concrete methods: Standard methods containing an actual implementation body.
2. Interfaces (100% Abstraction)
Will explain in the next blog.




Top comments (0)