Skip to content
Snippets Groups Projects
Commit cd586a13 authored by Mathea Berg Vindsetmo's avatar Mathea Berg Vindsetmo
Browse files

of5_2 lf

parent a895ae9b
No related branches found
No related tags found
No related merge requests found
package of5_2.lf;
public class Chicken implements Animal{
private int age;
private String name;
public Chicken(String name, int age) {
this.name = name;
this.age = age;
}
@Override
public String getName() {
return name;
}
@Override
public int getAge() {
return age;
}
@Override
public String makeSound() {
return name + " sier klukk!";
}
@Override
public int compareTo(Animal other) {
return this.getAge() - other.getAge();
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment