-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCat.java
More file actions
30 lines (29 loc) · 709 Bytes
/
Cat.java
File metadata and controls
30 lines (29 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import java.util.Comparator;
public class Cat extends Animal{
String name;
int number;
String type;
Cat(String name, int number, String type){
super(name,number);
//this.name=name;
//this.number=number;
setType(type);
}
void setType(String type){
this.type=type;
}
void eat(){
System.out.println("cat eat.");
}
void meow(){
System.out.println("cat meow.");
}
@Override
public String toString() {
return "Cat{" +
"name='" + name + '\'' +
", number=" + number +
", type='" + type + '\'' +
'}';
}
}