Which of the following best describes the inheritance in Java? code example
Example: inheritance in java
// super class
class Animal
{
void eat()
{
System.out.println("Animal is eating.");
}
}
// subclass
class Lion extends Animal
{
public static void main(String[] args)
{
Lion obj = new Lion();
obj.eat();
}
}