1
7 public class KoiraP extends Elain {
8
9 public KoiraP(String nimi, double paino) {
10 super(nimi,paino);
11 }
12
13 public void aantele() {
14 System.out.println("Hau hau");
15 }
16
17 public static void main(String[] args) {
18
19 KoiraP musti = new KoiraP("Musti",18000);
20
23 KoiraP pluto = new KoiraP("Pluto",1930);
24
27 Elain elukat[] = new Elain[4];
28 elukat[0] = musti;
29 elukat[1] = new KissaP("Mirri",18000);
30 elukat[2] = pluto;
31 elukat[3] = new KissaP("Miuku",980);
32
33 for (int i=0; i<elukat.length; i++) {
34 elukat[i].aantele();
35 elukat[i].tulosta();
36 }
37
38
39
40
41 }
42 }
43