Abstraction
Data abstraction is the process of hiding certain details and showing only essential information to the user.Abstract class: can have abstract and non-abstract methods. Abstract method: can only be used in an abstract class, and it does not have a body. The body is provided by the subclass.
abstract class Animal {
public abstract void animalSound();
public void sleep() {
System.out.println("Zzz");
}
}class Pig extends Animal {
public void animalSound() {
System.out.println("The pig says: wee wee");
}
}