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

26 lines
504 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);
}
public Sheep (){};
@Override
public void run() {
if (this.getName() != null){
System.out.println("Овечка " + this.getName() + " бегает.");
}
else {
System.out.println("Овечка бегает.");
}
}
@Override
public Voice getVoice(){
return "бее";
}
}