package hayvan; public class Hayvan { private String isim; public Hayvan(String isim) { this.isim = isim; } public String getIsim() { return isim; } public void setIsim(String isim) { this.isim = isim; } public void ses() { System.out.println("Hayvan sesi"); } } public class Horoz extends Hayvan { @Override public void ses() { System.out.println("Kukuletiyor"); } } public class Kangal extends Hayvan { public Kangal(String isim) { super(isim); } @Override public void ses() { System.out.println(getIsim() + " havliyor"); } public static void main(String[] args) { Horoz horoz = new Horoz(); horoz.ses(); Kangal kangal = new Kangal("Kangal"); kangal.ses(); } }