JAVA Abstraction

Abstraction is a process in which the implementation is hidden and only the functionality is shown to the user . In other words , “It shows only the necessary information to the user and the background details are hidden”.

For ex:

abstract class Animal{
    abstract void walk();
}
class Horse extends Animal{
    public void walk(){
        System.out.println("walks on 4 legs");
    }
}
class chicken extend Animal{
    public void walk(){
        System.out.println("walks on 2 legs");
    }
}
public class main{
    public static void main (String[]args){
    Horse horse =new horse();
    horse.walk();
        
    }
}