inheitance 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();
}
}