Ik heb een probleempje met overerving. De foutmelding als volgt:
De code staat hieronder:
Weet er iemand waarom deze foutmelding wordt gegeven??
Java:
1
2
3
| super.salaris = "" + aantal; syntax error: found 'super'. |
De code staat hieronder:
Java:
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
47
48
49
50
51
| public class Werknemer { String id,salaris,soort,voornaam,tussen,achternaam,straat, woonplaats,postcode,telnr,stuk,uur,werkSalaris; public Werknemer(String id,String salaris,String soort,String voornaam,String tussen,String achternaam,String straat,String woonplaats,String postcode,String telnr) { this.id = id; this.salaris = salaris; this.soort = soort; this.voornaam = voornaam; this.tussen = tussen; this.achternaam = achternaam; this.straat = straat; this.woonplaats = woonplaats; this.postcode = postcode; this.telnr = telnr; } public String toString() { return "*" + this.id + "*" + this.salaris + "*" + this.soort + "*" + this.voornaam + "*" + this.tussen + "*" + this.achternaam + "*" + this.straat + "*" + this.woonplaats + "*" + this.postcode + "*" + this.telnr ; } } public class Chef extends Werknemer { int aantal; public Chef(int aantal) { this.aantal = aantal; } public void berekenSalaris() { aantal = aantal *10 super.salaris = "" + aantal; } } |
Weet er iemand waarom deze foutmelding wordt gegeven??