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");
}
}
-
01-22-2018, 07:53 PM32Posts30ReputationMay 2017NextGenUpdate
-
02-17-2018, 04:04 AM16Posts70ReputationOct 2011NextGenUpdate
-
03-25-2018, 11:11 PM23Posts206ReputationJun 2014NextGenUpdate