:)
class Makhluk
{
public void info()
{
System.out.println("info makhluk");
}
}
class Mamalia extends Makhluk
{
public void info()
{
System.out.println("info() pada mamalia..");
}
}
class Sapi extends Mamalia
{
public void info()
{
System.out.println("info() pada sapi..");
}
}
public class poli1
{
public static void main(String[] args)
{
Makhluk tombol;
Mamalia mamalia=new Mamalia();
Sapi sapiSumba=new Sapi();
tombol=mamalia;
tombol.info(); //polymorphism
tombol=sapiSumba;
tombol.info(); //polymorphism
}
}
mantab banget gan
BalasHapussolder uap