forked from fuyutsuki/Texter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.yml
46 lines (42 loc) · 995 Bytes
/
plugin.yml
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
abstract class Animal {
private String name;
public Animal(String name) {
this.name = name;
}
public String speak() {
return name + " says " + sound();
}
public abstract String sound();
}
class Cow extends Animal {
public Cow(String name) {
super(name);
}
@Override public String sound() {
return "moooooo";
}
}
class Horse extends Animal {
public Horse(String name) {
super(name);
}
@Override public String sound() {
return "neigh";
}
}
class Sheep extends Animal {
public Sheep(String name) {
super(name);
}
@Override public String sound() {
return "baaaa";
}
}
public class AnimalDemo {
public static void main(String[] args) {
Animal h = new Horse("CJ");
System.out.println(h.speak());
Animal c = new Cow("Bessie");
System.out.println(c.speak());
System.out.println(new Sheep("Little Lamb").speak());
}