Smart way of hiding the implementation part of the Code with Java.

So Abstraction it is.

Abstraction is a way of hiding the implementation part of the code and showing the user only what he/she needs to do so as not to make things more complicated. It shows only functionality to the user.

Important points related to Abstract class:

  • Abstract class must contain an abstract method in it.

  • It can not be instantiated.

  • It is declared using Abstract keyword.

  • It can have constructors and static methods.

Examples for Abstract class:

abstract class bike{
    abstract void run();
}
class honda extends bike{
    public void run(){
        System.out.print("this bike runs fast");
    }
}

public class Main
{
    public static void main(String[] args) {
        honda h1 = new honda();
        h1.run();
    }
}