examples/src/main/java/animals/Sheep.java
2026-07-19 00:32:15 +03:00

24 lines
481 B
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package animals;
public class Sheep extends Herbivore implements Run, Voice {
public Sheep(String name) {
super(name);
}
@Override
public void run() {
if (this.getName() != null){
System.out.println("Овечка " + this.getName() + " бегает.");
}
else {
System.out.println("Овечка бегает.");
}
}
@Override
public String getVoice(){
return "бее";
}
}