|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Nx = newllä luotu näin mones "olio" keosta,
&Nx = viittaa x:äänteen new:llä luotuun olioon. |
|
|
|
|
|
staattiset aliohjelmat |
|
|
Keko |
Tulostus |
|
keko muuttuja |
|
|
|
N1 (SB) |
N2 (Sorsa) |
N3
(Sorsa) |
N4 (String) |
N5 (String) |
|
|
metodi |
|
main() |
|
|
|
|
Sorsa(inimi) |
hyppaa() |
|
|
Sorsa(inimi) |
hyppaa() |
|
|
|
|
* = viite |
* |
* |
* |
|
|
* |
* |
* |
|
* |
* |
* |
|
|
|
|
rivi |
nimi |
aku |
repe |
|
vari |
nimi |
inimi |
apu |
vari |
nimi |
inimi |
apu |
|
|
|
|
32
nimi=new StringBuffer("Väiski"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 aku=new Sorsa(nimi); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15
inimi.append("Aku"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 println(nimi); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 aku.tulosta(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 vari++; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 println(nimi + "
" + vari); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 repe = new Sorsa() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 nimi =
"Repe"; vari=0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 repe.tulosta() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 vari++; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 println(nimi + "
" + vari); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 aku.hyppaa(repe) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 apu.nimi =
"Senkin Sorsa"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 vari++; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 aku.tulosta(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 vari++; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 println(nimi + "
" + vari); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 aku=repe; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 aku.tulosta(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 vari++; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 println(nimi + "
" + vari); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|