public class Program
{
public static void main(String[] args) {
healthy a = new healthy();
healthy b = new unhealthy();
a.food();
b.food();
}
}
class healthy{
public void food(){
System.out.println("vegetable");
}
}
class unhealthy extends healthy{
public void food(){
System.out.println("meat");
}
}
Copyright © 2024, NextGenUpdate.
All Rights Reserved.